Skip to content

Commit

Permalink
fix vaults: pt 1
Browse files Browse the repository at this point in the history
  • Loading branch information
triphora committed Nov 26, 2021
1 parent a829967 commit 180320c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.frydae.emcutils;

import dev.architectury.event.events.client.ClientLifecycleEvent;
import dev.architectury.injectables.annotations.ExpectPlatform;
import dev.architectury.registry.menu.MenuRegistry;
import dev.architectury.registry.registries.Registries;
import dev.frydae.emcutils.features.UsableItems;
import dev.frydae.emcutils.features.VaultScreen;
Expand All @@ -14,7 +12,6 @@
import dev.frydae.emcutils.utils.Config;
import dev.frydae.emcutils.utils.MidnightConfig;
import dev.frydae.emcutils.utils.Util;
import net.minecraft.client.MinecraftClient;

import static dev.frydae.emcutils.utils.Util.MODID;

Expand All @@ -30,12 +27,6 @@ public static void initClient() {
VaultScreen.initStatic();

Util.getOnJoinCommandQueue();

ClientLifecycleEvent.CLIENT_SETUP.register(EmpireMinecraftUtilities::onClientSetup);
}

public static void onClientSetup(MinecraftClient client) {
MenuRegistry.registerScreenFactory(VaultScreen.GENERIC_9X7.get(), VaultScreen::new);
}

@SuppressWarnings("InstantiationOfUtilityClass")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ public class VaultScreen extends HandledScreen<GenericContainerScreenHandler> im

static {
Registrar<ScreenHandlerType<?>> screenHandlers = EmpireMinecraftUtilities.REGISTRIES.get(Registry.MENU_KEY);
GENERIC_9X7 = screenHandlers.register(new Identifier("generic_9x7"), () -> MenuRegistry.of(CreateGeneric9x7::createGeneric9x7));
GENERIC_9X7 = screenHandlers.register(new Identifier(MODID, "generic_9x7"), () -> MenuRegistry.of(CreateGeneric9x7::createGeneric9x7));
}

// This is necessary because Basique said so
// also makes forge client not crash
public static void initStatic() {}

public VaultScreen(GenericContainerScreenHandler handler, PlayerInventory inventory, Text title) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package dev.frydae.emcutils.fabric;

import dev.architectury.registry.menu.MenuRegistry;
import dev.frydae.emcutils.EmpireMinecraftUtilities;
import dev.frydae.emcutils.features.VaultScreen;
import dev.frydae.emcutils.features.fabric.VoxelMapIntegration;
import dev.frydae.emcutils.tasks.GetLocationTask;
import dev.frydae.emcutils.tasks.Tasks;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;

import static dev.frydae.emcutils.utils.Util.LOG;
import static dev.frydae.emcutils.utils.Util.MODID;
Expand All @@ -18,6 +21,8 @@ public class EmpireMinecraftUtilitiesImpl implements ClientModInitializer {
public void onInitializeClient() {
EmpireMinecraftUtilities.initClient();

MenuRegistry.registerScreenFactory(VaultScreen.GENERIC_9X7.get(), VaultScreen::new);

if (hasVoxelMap) LOG.info(MODID + " found VoxelMap - enabling integrations");
if (hasXaeroMap) LOG.info(MODID + " found Xaero's World Map - enabling integrations");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package dev.frydae.emcutils.forge;

import dev.architectury.event.events.client.ClientLifecycleEvent;
import dev.architectury.platform.forge.EventBuses;
import dev.architectury.registry.menu.MenuRegistry;
import dev.frydae.emcutils.EmpireMinecraftUtilities;
import dev.frydae.emcutils.features.VaultScreen;
import dev.frydae.emcutils.utils.MidnightConfig;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
Expand All @@ -20,6 +23,9 @@ public EmpireMinecraftUtilitiesImpl() {

DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> EmpireMinecraftUtilities::initClient);

ClientLifecycleEvent.CLIENT_SETUP.register(client ->
MenuRegistry.registerScreenFactory(VaultScreen.GENERIC_9X7.get(), VaultScreen::new));

ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () ->
new IExtensionPoint.DisplayTest(() -> "", (a, b) -> b));

Expand Down
9 changes: 3 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ org.gradle.parallel=true

mc_version=1.17.1
mc_version_major=1.17
mod_version=2.3.2
mod_version=2.3.3

release_title=Add Forge release & fix vault alignment
changeLog=**Empire Minecraft Utilities v2.3.2 for 1.17.1 and 1.18-rc1 is now released! "Add Forge release & fix vault alignment"**\n\n\
Surprise! Between now and the last release, emcutils has been ported to Architectury. What this means is that the mod can now support Forge and Fabric simultaneously.\n\n\
As a result, Architectury API is now required. It can be downloaded for [Fabric](https://www.curseforge.com/minecraft/mc-mods/architectury-fabric) or [Forge](https://www.curseforge.com/minecraft/mc-mods/architectury-forge).\n\n\
This release also fixes a bug where the highlights for the vault were misaligned with the actual location of the slots. Have fun!
release_title=Fix vaults not working
changeLog=Fixed a bug where vaults would not work at all. Whoops.

# https://fabricmc.net/versions.html
yarn_mappings=64
Expand Down
8 changes: 4 additions & 4 deletions setupAuth.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ import com.mojang.authlib.Agent
import com.mojang.authlib.properties.PropertyMap
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService

project.ext.credentials = new Properties()
rootProject.ext.credentials = new Properties()
try {
project.ext.credentials.load(new FileReader(file('credentials.properties')))
rootProject.ext.credentials.load(new FileReader(file('credentials.properties')))
} catch (IOException ignore) {
}

task setupAuth {
group = 'ide'
doLast {
def username = project.ext.credentials['minecraftUser']
def password = project.ext.credentials['minecraftPass']
def username = rootProject.ext.credentials['minecraftUser']
def password = rootProject.ext.credentials['minecraftPass']
def auth = new YggdrasilAuthenticationService(Proxy.NO_PROXY, '1').createUserAuthentication(Agent.MINECRAFT)
auth.username = username
auth.password = password
Expand Down

0 comments on commit 180320c

Please sign in to comment.