From 1a9e72178881ca41321c730eb69ce28f0b6ad171 Mon Sep 17 00:00:00 2001 From: SHsuperCM Date: Sat, 5 Feb 2022 07:46:52 +0200 Subject: Migrated to using Fletching Table --- src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java | 8 ++++---- .../fabric/citresewn/config/CITResewnConfigScreenFactory.java | 4 +++- .../shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java | 2 ++ .../java/shcm/shsupercm/fabric/citresewn/pack/ActiveCITs.java | 2 +- .../fabric/citresewn/registry/api/GlobalPropertiesHandler.java | 4 +++- .../java/shcm/shsupercm/fabric/citresewn/util/Disposable.java | 2 ++ 6 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src/main/java/shcm/shsupercm') diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java b/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java index 0a0051f..807aa97 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java @@ -1,5 +1,6 @@ package shcm.shsupercm.fabric.citresewn; +import io.shcm.shsupercm.fabric.fletchingtable.api.Entrypoint; import net.fabricmc.api.ClientModInitializer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -7,13 +8,12 @@ import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig; public class CITResewn implements ClientModInitializer { public static final Logger LOG = LogManager.getLogger("CITResewn"); - public static CITResewn INSTANCE; - - public boolean processingBrokenPaths = false; + @Entrypoint(Entrypoint.CLIENT) + public static final CITResewn INSTANCE = new CITResewn(); @Override public void onInitializeClient() { - INSTANCE = this; + info("init"); } public static void info(String message) { diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java index 57ae2c3..76576ba 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnConfigScreenFactory.java @@ -14,6 +14,8 @@ import net.minecraft.util.Formatting; import java.util.function.Function; public class CITResewnConfigScreenFactory { + public static final String DEFAULTS_CONFIG_ENTRYPOINT = "citresewn-defaults:config_screen"; + public static Screen create(Screen parent) { CITResewnConfig currentConfig = CITResewnConfig.INSTANCE, defaultConfig = new CITResewnConfig(); @@ -42,7 +44,7 @@ public class CITResewnConfigScreenFactory { .setYesNoTextSupplier((b) -> { if (b != currentScreen.prevToggle) { //noinspection unchecked - MinecraftClient.getInstance().setScreen((Screen) FabricLoader.getInstance().getEntrypoints("citresewn-defaults:config_screen", Function.class).stream().findAny().orElseThrow().apply(currentScreen.screen)); + MinecraftClient.getInstance().setScreen((Screen) FabricLoader.getInstance().getEntrypoints(DEFAULTS_CONFIG_ENTRYPOINT, Function.class).stream().findAny().orElseThrow().apply(currentScreen.screen)); currentScreen.prevToggle = b; } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java index 378350a..521c3b6 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/config/CITResewnModMenu.java @@ -2,11 +2,13 @@ package shcm.shsupercm.fabric.citresewn.config; import com.terraformersmc.modmenu.api.ConfigScreenFactory; import com.terraformersmc.modmenu.api.ModMenuApi; +import io.shcm.shsupercm.fabric.fletchingtable.api.Entrypoint; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.NoticeScreen; import net.minecraft.text.Text; +@Entrypoint("modmenu") public class CITResewnModMenu implements ModMenuApi { @Override public ConfigScreenFactory getModConfigScreenFactory() { diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/ActiveCITs.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/ActiveCITs.java index 8e5faa3..5523c84 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/ActiveCITs.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/ActiveCITs.java @@ -37,7 +37,7 @@ public class ActiveCITs implements Disposable { private ActiveCITs() {} @Override public void dispose() { - for (Disposable disposable : FabricLoader.getInstance().getEntrypoints("citresewn:dispose", Disposable.class)) + for (Disposable disposable : FabricLoader.getInstance().getEntrypoints(Disposable.ENTRYPOINT, Disposable.class)) disposable.dispose(); diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/registry/api/GlobalPropertiesHandler.java b/src/main/java/shcm/shsupercm/fabric/citresewn/registry/api/GlobalPropertiesHandler.java index e5a2820..9b1ad6f 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/registry/api/GlobalPropertiesHandler.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/registry/api/GlobalPropertiesHandler.java @@ -4,5 +4,7 @@ import shcm.shsupercm.fabric.citresewn.format.PropertyValue; @FunctionalInterface public interface GlobalPropertiesHandler { - void globalProperty(String key, PropertyValue value); + String ENTRYPOINT = "citresewn:global_property"; + + boolean globalProperty(String key, PropertyValue value); } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/util/Disposable.java b/src/main/java/shcm/shsupercm/fabric/citresewn/util/Disposable.java index 84c65b2..7878e16 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/util/Disposable.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/util/Disposable.java @@ -2,5 +2,7 @@ package shcm.shsupercm.fabric.citresewn.util; @FunctionalInterface public interface Disposable { + String ENTRYPOINT = "citresewn:dispose"; + void dispose(); } -- cgit