diff options
9 files changed, 31 insertions, 18 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java b/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java index e3e25f0..c4b545e 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/BackgroundPainter.java @@ -1,5 +1,7 @@ package io.github.cottonmc.cotton.gui.client; +import io.github.cottonmc.cotton.gui.impl.LibGuiCommon; + import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; @@ -34,8 +36,8 @@ public interface BackgroundPainter { * @since 1.5.0 */ public static BackgroundPainter VANILLA = createLightDarkVariants( - createNinePatch(new Identifier("libgui", "textures/widget/panel_light.png"), 8), - createNinePatch(new Identifier("libgui", "textures/widget/panel_dark.png"), 8) + createNinePatch(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/panel_light.png"), 8), + createNinePatch(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/panel_dark.png"), 8) ); /** diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/LibGuiCommon.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/LibGuiCommon.java index 5e87287..33e9575 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/LibGuiCommon.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/LibGuiCommon.java @@ -3,6 +3,8 @@ package io.github.cottonmc.cotton.gui.impl; import net.fabricmc.api.ModInitializer; public final class LibGuiCommon implements ModInitializer { + public static final String MOD_ID = "libgui"; + @Override public void onInitialize() { ScreenNetworkingImpl.init(); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java index 58c7831..0d9a74e 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java @@ -26,8 +26,8 @@ public class ScreenNetworkingImpl implements ScreenNetworking { // message: identifier // rest: buf - public static final Identifier SCREEN_MESSAGE_S2C = new Identifier("libgui", "screen_message_s2c"); - public static final Identifier SCREEN_MESSAGE_C2S = new Identifier("libgui", "screen_message_c2s"); + public static final Identifier SCREEN_MESSAGE_S2C = new Identifier(LibGuiCommon.MOD_ID, "screen_message_s2c"); + public static final Identifier SCREEN_MESSAGE_C2S = new Identifier(LibGuiCommon.MOD_ID, "screen_message_c2s"); private static final Logger LOGGER = LogManager.getLogger(); private static final Map<SyncedGuiDescription, ScreenNetworkingImpl> instanceCache = new WeakHashMap<>(); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java index 97109c2..d9bc2d5 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java @@ -20,7 +20,6 @@ import java.nio.charset.StandardCharsets; public class LibGuiClient implements ClientModInitializer { public static final Logger logger = LogManager.getLogger(); - public static final String MODID = "libgui"; public static volatile LibGuiConfig config; public static final Jankson jankson = JanksonFactory.createJankson(); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NinePatchInternals.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NinePatchInternals.java index 7a18413..cab163e 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NinePatchInternals.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NinePatchInternals.java @@ -2,6 +2,8 @@ package io.github.cottonmc.cotton.gui.impl.client; import io.github.cottonmc.cotton.gui.client.NinePatch; +import io.github.cottonmc.cotton.gui.impl.LibGuiCommon; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener; @@ -39,7 +41,7 @@ public final class NinePatchInternals { public static class MetadataLoader extends SinglePreparationResourceReloadListener<Map<Identifier, Properties>> implements IdentifiableResourceReloadListener { public static final MetadataLoader INSTANCE = new MetadataLoader(); - private static final Identifier ID = new Identifier("libgui", "9patch_metadata"); + private static final Identifier ID = new Identifier(LibGuiCommon.MOD_ID, "9patch_metadata"); private static final String SUFFIX = ".9patch"; private Map<Identifier, TextureProperties> properties = Collections.emptyMap(); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/WKirbSprite.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/WKirbSprite.java index 4ea5324..18f6f8d 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/WKirbSprite.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/WKirbSprite.java @@ -1,5 +1,7 @@ package io.github.cottonmc.cotton.gui.impl.modmenu; +import io.github.cottonmc.cotton.gui.impl.LibGuiCommon; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.util.math.MatrixStack; @@ -12,7 +14,7 @@ import io.github.cottonmc.cotton.gui.widget.WWidget; import java.util.ArrayList; public class WKirbSprite extends WWidget { - private static final Identifier KIRB = new Identifier("libgui:textures/widget/kirb.png"); + private static final Identifier KIRB = new Identifier(LibGuiCommon.MOD_ID, "textures/widget/kirb.png"); private static final float PX = 1f/416f; private static final float KIRB_WIDTH = 32*PX; diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java index a63c9cb..004b87e 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WSlider.java @@ -1,5 +1,7 @@ package io.github.cottonmc.cotton.gui.widget; +import io.github.cottonmc.cotton.gui.impl.LibGuiCommon; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.util.math.MatrixStack; @@ -19,8 +21,8 @@ import org.jetbrains.annotations.Nullable; public class WSlider extends WAbstractSlider { public static final int TRACK_WIDTH = 6; public static final int THUMB_SIZE = 8; - public static final Identifier LIGHT_TEXTURE = new Identifier("libgui", "textures/widget/slider_light.png"); - public static final Identifier DARK_TEXTURE = new Identifier("libgui", "textures/widget/slider_dark.png"); + public static final Identifier LIGHT_TEXTURE = new Identifier(LibGuiCommon.MOD_ID, "textures/widget/slider_light.png"); + public static final Identifier DARK_TEXTURE = new Identifier(LibGuiCommon.MOD_ID, "textures/widget/slider_dark.png"); @Environment(EnvType.CLIENT) @Nullable diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java index 09e4e1d..48a5e59 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java @@ -1,5 +1,7 @@ package io.github.cottonmc.cotton.gui.widget; +import io.github.cottonmc.cotton.gui.impl.LibGuiCommon; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -364,16 +366,16 @@ public class WTabPanel extends WPanel { @Environment(EnvType.CLIENT) final static class Painters { static final BackgroundPainter SELECTED_TAB = BackgroundPainter.createLightDarkVariants( - BackgroundPainter.createNinePatch(new Identifier("libgui", "textures/widget/tab/selected_light.png")).setTopPadding(2), - BackgroundPainter.createNinePatch(new Identifier("libgui", "textures/widget/tab/selected_dark.png")).setTopPadding(2) + BackgroundPainter.createNinePatch(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/tab/selected_light.png")).setTopPadding(2), + BackgroundPainter.createNinePatch(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/tab/selected_dark.png")).setTopPadding(2) ); static final BackgroundPainter UNSELECTED_TAB = BackgroundPainter.createLightDarkVariants( - BackgroundPainter.createNinePatch(new Identifier("libgui", "textures/widget/tab/unselected_light.png")), - BackgroundPainter.createNinePatch(new Identifier("libgui", "textures/widget/tab/unselected_dark.png")) + BackgroundPainter.createNinePatch(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/tab/unselected_light.png")), + BackgroundPainter.createNinePatch(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/tab/unselected_dark.png")) ); - static final BackgroundPainter SELECTED_TAB_FOCUS_BORDER = BackgroundPainter.createNinePatch(new Identifier("libgui", "textures/widget/tab/focus.png")).setTopPadding(2); - static final BackgroundPainter UNSELECTED_TAB_FOCUS_BORDER = BackgroundPainter.createNinePatch(new Identifier("libgui", "textures/widget/tab/focus.png")); + static final BackgroundPainter SELECTED_TAB_FOCUS_BORDER = BackgroundPainter.createNinePatch(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/tab/focus.png")).setTopPadding(2); + static final BackgroundPainter UNSELECTED_TAB_FOCUS_BORDER = BackgroundPainter.createNinePatch(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/tab/focus.png")); } } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java index 2f3cfc7..c74f131 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java @@ -1,5 +1,7 @@ package io.github.cottonmc.cotton.gui.widget; +import io.github.cottonmc.cotton.gui.impl.LibGuiCommon; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -18,9 +20,9 @@ import java.util.function.Consumer; public class WToggleButton extends WWidget { // Default on/off images - protected static final Texture DEFAULT_OFF_IMAGE = new Texture(new Identifier("libgui:textures/widget/toggle_off.png")); - protected static final Texture DEFAULT_ON_IMAGE = new Texture(new Identifier("libgui:textures/widget/toggle_on.png")); - protected static final Texture DEFAULT_FOCUS_IMAGE = new Texture(new Identifier("libgui:textures/widget/toggle_focus.png")); + protected static final Texture DEFAULT_OFF_IMAGE = new Texture(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/toggle_off.png")); + protected static final Texture DEFAULT_ON_IMAGE = new Texture(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/toggle_on.png")); + protected static final Texture DEFAULT_FOCUS_IMAGE = new Texture(new Identifier(LibGuiCommon.MOD_ID, "textures/widget/toggle_focus.png")); protected Texture onImage; protected Texture offImage; |