Skip to content

Commit

Permalink
Switch to ModularUI.ID from Tags.MODID
Browse files Browse the repository at this point in the history
  • Loading branch information
miozune committed Nov 5, 2023
1 parent 8cb120a commit 3255048
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/cleanroommc/modularui/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class CommonProxy {

void preInit(FMLPreInitializationEvent event) {
ModularUIConfig.init(event.getSuggestedConfigurationFile());
NetworkRegistry.INSTANCE.registerGuiHandler(Tags.MODID, GuiManager.INSTANCE);
NetworkRegistry.INSTANCE.registerGuiHandler(ModularUI.ID, GuiManager.INSTANCE);
GuiInfos.init();

if (ModularUIConfig.enableTestGuis) {
Expand Down Expand Up @@ -59,7 +59,7 @@ public Timer getTimer60Fps() {

@SubscribeEvent
public final void onConfigChange(ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.modID.equals(Tags.MODID)) {
if (event.modID.equals(ModularUI.ID)) {
ModularUIConfig.syncConfig();
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/main/java/com/cleanroommc/modularui/ModularUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,26 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Mod(modid = Tags.MODID, name = Tags.MODNAME, version = Tags.VERSION, dependencies = ModularUI.DEPENDENCIES, guiFactory = ModularUI.GUI_FACTORY)
@Mod(modid = ModularUI.ID, name = Tags.MODNAME, version = Tags.VERSION, dependencies = ModularUI.DEPENDENCIES, guiFactory = ModularUI.GUI_FACTORY)
public class ModularUI {

public static final String DEPENDENCIES = "required-after:gtnhmixins@[2.0.1,); "
static final String DEPENDENCIES = "required-after:gtnhmixins@[2.0.1,); "
+ "required-after:NotEnoughItems@[2.3.27-GTNH,);"
+ "after:hodgepodge@[2.0.0,);"
+ "before:gregtech";
public static final String GUI_FACTORY = Tags.GROUPNAME + ".config.GuiFactory";
static final String GUI_FACTORY = Tags.GROUPNAME + ".config.GuiFactory";

public static final Logger LOGGER = LogManager.getLogger(Tags.MODID);
public static final String ID = Tags.MODID;

public static final Logger LOGGER = LogManager.getLogger(ID);

public static final String MODID_GT5U = "gregtech";
public static final String MODID_GT6 = "gregapi_post";
public static final boolean isGT5ULoaded = Loader.isModLoaded(MODID_GT5U) && !Loader.isModLoaded(MODID_GT6);
public static final boolean isHodgepodgeLoaded = Loader.isModLoaded("hodgepodge");

@SidedProxy(
modId = Tags.MODID,
modId = ModularUI.ID,
clientSide = Tags.GROUPNAME + ".ClientProxy",
serverSide = Tags.GROUPNAME + ".CommonProxy")
public static CommonProxy proxy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ModularUIConfig {
public static final String CATEGORY_RENDERING = "rendering";
public static final String CATEGORY_DEBUG = "debug";

private static final String LANG_PREFIX = Tags.MODID + ".config.";
private static final String LANG_PREFIX = ModularUI.ID + ".config.";

public static final String[] CATEGORIES = new String[] {
CATEGORY_RENDERING,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.cleanroommc.modularui.config;

import com.cleanroommc.modularui.ModularUI;
import com.cleanroommc.modularui.ModularUIConfig;
import com.cleanroommc.modularui.Tags;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
import net.minecraft.client.gui.GuiScreen;
Expand All @@ -18,7 +18,7 @@ public ModularUIGuiConfig(GuiScreen parentScreen) {
super(
parentScreen,
getConfigElements(),
Tags.MODID,
ModularUI.ID,
false,
false,
GuiConfig.getAbridgedConfigPath(ModularUIConfig.config.toString()));
Expand Down
41 changes: 20 additions & 21 deletions src/main/java/com/cleanroommc/modularui/drawable/GuiTextures.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.cleanroommc.modularui.drawable;

import com.cleanroommc.modularui.ModularUI;
import com.cleanroommc.modularui.Tags;
import com.cleanroommc.modularui.api.GuiAxis;
import net.minecraft.util.ResourceLocation;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -50,7 +49,7 @@ public static UITexture getBackground(String key) {
/**
* Icons copied from mclib
*/
public static final ResourceLocation ICONS_LOCATION = new ResourceLocation(Tags.MODID, "textures/gui/icons.png");
public static final ResourceLocation ICONS_LOCATION = new ResourceLocation(ModularUI.ID, "textures/gui/icons.png");
public static final UITexture GEAR = icon("gear", 0, 0);
public static final UITexture MORE = icon("more", 16, 0);
public static final UITexture SAVED = icon("saved", 32, 0);
Expand Down Expand Up @@ -122,79 +121,79 @@ public static UITexture getBackground(String key) {
public static final UITexture CURSOR = icon("cursor", 32, 240);

public static final UITexture LOGO = UITexture.builder()
.location(Tags.MODID, "modular_ui_logo")
.location(ModularUI.ID, "modular_ui_logo")
.imageSize(603, 603)
.registerAsIcon("logo")
.build();

public static final UITexture BACKGROUND = UITexture.builder()
.location(Tags.MODID, "gui/background/vanilla_background")
.location(ModularUI.ID, "gui/background/vanilla_background")
.imageSize(195, 136)
.adaptable(4)
.registerAsBackground("vanilla_background")
.build();

public static final UITexture DISPLAY = UITexture.builder()
.location(Tags.MODID, "gui/background/display")
.location(ModularUI.ID, "gui/background/display")
.imageSize(143, 75)
.adaptable(2)
.registerAsBackground("display", false)
.build();

public static final UITexture DISPLAY_SMALL = UITexture.builder()
.location(Tags.MODID, "gui/background/display_small")
.location(ModularUI.ID, "gui/background/display_small")
.imageSize(18, 18)
.adaptable(1)
.registerAsBackground("display_small", false)
.build();

public static final UITexture BUTTON = UITexture.builder()
.location(Tags.MODID, "gui/widgets/base_button")
.location(ModularUI.ID, "gui/widgets/base_button")
.imageSize(18, 18)
.adaptable(1)
.registerAsBackground("vanilla_button", true)
.build();

public static final UITexture SLOT = UITexture.builder()
.location(Tags.MODID, "gui/slot/item")
.location(ModularUI.ID, "gui/slot/item")
.imageSize(18, 18)
.adaptable(1)
.registerAsBackground("slot_item")
.build();

public static final UITexture SLOT_DARK = UITexture.builder()
.location(Tags.MODID, "gui/slot/fluid")
.location(ModularUI.ID, "gui/slot/fluid")
.imageSize(18, 18)
.adaptable(1)
.registerAsBackground("slot_fluid")
.build();

public static final UITexture PROGRESS_ARROW = UITexture.builder()
.location(Tags.MODID, "gui/widgets/progress_bar_arrow")
.location(ModularUI.ID, "gui/widgets/progress_bar_arrow")
.imageSize(20, 40)
.build();

public static final UITexture PROGRESS_CYCLE = UITexture.builder()
.location(Tags.MODID, "gui/widgets/progress_bar_mixer")
.location(ModularUI.ID, "gui/widgets/progress_bar_mixer")
.imageSize(20, 40)
.build();

public static final UITexture CYCLE_BUTTON_DEMO = UITexture.builder()
.location(Tags.MODID, "gui/widgets/cycle_button_demo")
.location(ModularUI.ID, "gui/widgets/cycle_button_demo")
.imageSize(18, 54)
.build();

public static final UITexture CHECK_BOX = UITexture.fullImage(Tags.MODID, "gui/widgets/toggle_config");
public static final UITexture CROSS = UITexture.fullImage(Tags.MODID, "gui/icons/cross");
public static final UITexture CROSS_TINY = UITexture.fullImage(Tags.MODID, "gui/icons/cross_tiny");
public static final UITexture CHECK_BOX = UITexture.fullImage(ModularUI.ID, "gui/widgets/toggle_config");
public static final UITexture CROSS = UITexture.fullImage(ModularUI.ID, "gui/icons/cross");
public static final UITexture CROSS_TINY = UITexture.fullImage(ModularUI.ID, "gui/icons/cross_tiny");

public static final TabTexture TAB_TOP = TabTexture.of(UITexture.fullImage(Tags.MODID, "gui/tab/tabs_top", true), GuiAxis.Y, false, 28, 32, 4);
public static final TabTexture TAB_BOTTOM = TabTexture.of(UITexture.fullImage(Tags.MODID, "gui/tab/tabs_bottom", true), GuiAxis.Y, true, 28, 32, 4);
public static final TabTexture TAB_LEFT = TabTexture.of(UITexture.fullImage(Tags.MODID, "gui/tab/tabs_left", true), GuiAxis.X, false, 32, 28, 4);
public static final TabTexture TAB_RIGHT = TabTexture.of(UITexture.fullImage(Tags.MODID, "gui/tab/tabs_right", true), GuiAxis.X, true, 32, 28, 4);
public static final TabTexture TAB_TOP = TabTexture.of(UITexture.fullImage(ModularUI.ID, "gui/tab/tabs_top", true), GuiAxis.Y, false, 28, 32, 4);
public static final TabTexture TAB_BOTTOM = TabTexture.of(UITexture.fullImage(ModularUI.ID, "gui/tab/tabs_bottom", true), GuiAxis.Y, true, 28, 32, 4);
public static final TabTexture TAB_LEFT = TabTexture.of(UITexture.fullImage(ModularUI.ID, "gui/tab/tabs_left", true), GuiAxis.X, false, 32, 28, 4);
public static final TabTexture TAB_RIGHT = TabTexture.of(UITexture.fullImage(ModularUI.ID, "gui/tab/tabs_right", true), GuiAxis.X, true, 32, 28, 4);

public static final UITexture ARROW_UP = UITexture.fullImage(Tags.MODID, "gui/icons/arrow_up", false);
public static final UITexture ARROW_DOWN = UITexture.fullImage(Tags.MODID, "gui/icons/arrow_down", false);
public static final UITexture ARROW_UP = UITexture.fullImage(ModularUI.ID, "gui/icons/arrow_up", false);
public static final UITexture ARROW_DOWN = UITexture.fullImage(ModularUI.ID, "gui/icons/arrow_down", false);

private static UITexture icon(String name, int x, int y, int w, int h) {
return UITexture.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.cleanroommc.modularui.drawable;

import com.cleanroommc.modularui.Tags;
import com.cleanroommc.modularui.ModularUI;
import com.cleanroommc.modularui.api.ITheme;
import com.cleanroommc.modularui.api.drawable.IDrawable;
import com.cleanroommc.modularui.screen.viewport.GuiContext;
Expand Down Expand Up @@ -143,7 +143,7 @@ public static IDrawable parseFromJson(JsonObject json) {
if (drawable != null) return drawable;
}
Builder builder = builder();
builder.location(JsonHelper.getString(json, Tags.MODID + ":gui/widgets/error", "location"))
builder.location(JsonHelper.getString(json, ModularUI.ID + ":gui/widgets/error", "location"))
.imageSize(JsonHelper.getInt(json, defaultImageWidth, "imageWidth", "iw"), JsonHelper.getInt(json, defaultImageHeight, "imageHeight", "ih"));
boolean mode1 = json.has("x") || json.has("y") || json.has("w") || json.has("h") || json.has("width") || json.has("height");
boolean mode2 = json.has("u0") || json.has("v0") || json.has("u1") || json.has("u1");
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/cleanroommc/modularui/manager/GuiInfo.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.cleanroommc.modularui.manager;

import com.cleanroommc.modularui.Tags;
import com.cleanroommc.modularui.ModularUI;
import com.cleanroommc.modularui.network.NetworkUtils;
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.screen.ModularScreen;
Expand Down Expand Up @@ -70,7 +70,7 @@ public void open(EntityPlayer player) {
if (NetworkUtils.isClient(player)) {
throw new IllegalStateException("Synced GUIs must be opened on server side only!");
}
FMLNetworkHandler.openGui(player, Tags.MODID, this.id, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
FMLNetworkHandler.openGui(player, ModularUI.ID, this.id, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
}

/**
Expand All @@ -92,7 +92,7 @@ public void open(EntityPlayer player, World world, int x, int y, int z) {
if (world.isRemote) {
throw new IllegalStateException("EntityPlayer is server side, but World isn't!");
}
FMLNetworkHandler.openGui(player, Tags.MODID, this.id, world, x, y, z);
FMLNetworkHandler.openGui(player, ModularUI.ID, this.id, world, x, y, z);
}

ModularPanel createCommonGui(GuiCreationContext context, GuiSyncManager guiSyncManager) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.cleanroommc.modularui.network;

import com.cleanroommc.modularui.Tags;
import com.cleanroommc.modularui.ModularUI;
import com.cleanroommc.modularui.network.packets.PacketSyncHandler;
import com.cleanroommc.modularui.network.packets.SClipboard;
import com.cleanroommc.modularui.network.packets.SyncConfig;
Expand All @@ -15,7 +15,7 @@

public class NetworkHandler {

public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(Tags.MODID);
public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(ModularUI.ID);
private static int packetId = 0;

public static void init() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.cleanroommc.modularui.screen;

import com.cleanroommc.modularui.Tags;
import com.cleanroommc.modularui.ModularUI;
import com.cleanroommc.modularui.screen.viewport.GuiContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
Expand All @@ -17,7 +17,7 @@ public abstract class CustomModularScreen extends ModularScreen {
* Creates a new screen with ModularUI as its owner.
*/
public CustomModularScreen() {
super(Tags.MODID);
super(ModularUI.ID);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.cleanroommc.modularui.screen;

import com.cleanroommc.modularui.Tags;
import com.cleanroommc.modularui.ModularUI;
import com.cleanroommc.modularui.api.ITheme;
import com.cleanroommc.modularui.api.IThemeApi;
import com.cleanroommc.modularui.api.widget.IGuiAction;
Expand Down Expand Up @@ -82,7 +82,7 @@ public static ModularScreen getCurrent() {
* @param mainPanel main panel of this screen
*/
public ModularScreen(@NotNull ModularPanel mainPanel) {
this(Tags.MODID, mainPanel);
this(ModularUI.ID, mainPanel);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.cleanroommc.modularui.test;

import com.cleanroommc.modularui.ModularUI;
import com.cleanroommc.modularui.Tags;
import com.cleanroommc.modularui.api.drawable.IKey;
import com.cleanroommc.modularui.future.ItemStackHandler;
import com.cleanroommc.modularui.manager.GuiCreationContext;
Expand Down Expand Up @@ -31,7 +30,7 @@
public class ItemEditorGui {

private static final GuiInfo GUI_INFO = GuiInfo.builder()
.clientGui((creationContext, panel) -> new ModularScreen(Tags.MODID, panel))
.clientGui((creationContext, panel) -> new ModularScreen(ModularUI.ID, panel))
.commonGui((creationContext, syncManager) -> new ItemEditorGui().buildUI(creationContext, syncManager))
.build();

Expand Down

0 comments on commit 3255048

Please sign in to comment.