diff --git a/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch index 12d29ddb2..fc8429b71 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/MainMenuScreen.java.patch @@ -18,7 +18,7 @@ } else { this.func_73969_a(j, 24); + modbutton = this.addButton(new Button(this.width / 2 - 100, j + 24 * 2, 98, 20, I18n.func_135052_a("fml.menu.mods"), button -> { -+ this.minecraft.func_147108_a(new net.minecraftforge.fml.client.gui.ModListScreen(this)); ++ this.minecraft.func_147108_a(new net.minecraftforge.fml.client.gui.screen.ModListScreen(this)); + })); } diff --git a/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch index 4c3efb535..afe84ee03 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/Screen.java.patch @@ -6,9 +6,9 @@ protected void renderTooltip(ItemStack p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_) { - this.renderTooltip(this.getTooltipFromItem(p_renderTooltip_1_), p_renderTooltip_2_, p_renderTooltip_3_); + FontRenderer font = p_renderTooltip_1_.func_77973_b().getFontRenderer(p_renderTooltip_1_); -+ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_renderTooltip_1_); ++ net.minecraftforge.fml.client.gui.GuiUtils.preItemToolTip(p_renderTooltip_1_); + this.renderTooltip(this.getTooltipFromItem(p_renderTooltip_1_), p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font)); -+ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip(); ++ net.minecraftforge.fml.client.gui.GuiUtils.postItemToolTip(); } public List getTooltipFromItem(ItemStack p_getTooltipFromItem_1_) { @@ -20,7 +20,7 @@ + renderTooltip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, font); + } + public void renderTooltip(List p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_, FontRenderer font) { -+ net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, width, height, -1, font); ++ net.minecraftforge.fml.client.gui.GuiUtils.drawHoveringText(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, width, height, -1, font); + if (false && !p_renderTooltip_1_.isEmpty()) { RenderSystem.disableRescaleNormal(); RenderSystem.disableDepthTest(); diff --git a/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch index 8653b5c17..796ead83f 100644 --- a/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screen/inventory/CreativeScreen.java.patch @@ -180,9 +180,9 @@ - this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_); + net.minecraft.client.gui.FontRenderer font = p_renderTooltip_1_.func_77973_b().getFontRenderer(p_renderTooltip_1_); -+ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_renderTooltip_1_); ++ net.minecraftforge.fml.client.gui.GuiUtils.preItemToolTip(p_renderTooltip_1_); + this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font)); -+ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip(); ++ net.minecraftforge.fml.client.gui.GuiUtils.postItemToolTip(); } else { super.renderTooltip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_); } diff --git a/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java b/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java index e31007051..7a830dd2a 100644 --- a/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java +++ b/src/main/java/net/minecraftforge/client/gui/ScrollPanel.java @@ -24,7 +24,6 @@ import java.util.List; import org.lwjgl.opengl.GL11; -import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; @@ -35,7 +34,7 @@ import net.minecraft.client.gui.IRenderable; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraftforge.fml.client.config.GuiUtils; +import net.minecraftforge.fml.client.gui.GuiUtils; public abstract class ScrollPanel extends FocusableGui implements IRenderable { diff --git a/src/main/java/net/minecraftforge/common/ForgeConfig.java b/src/main/java/net/minecraftforge/common/ForgeConfig.java index 77cb8662c..e13e49906 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfig.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfig.java @@ -201,7 +201,7 @@ public class ForgeConfig } @SubscribeEvent - public static void onFileChange(final ModConfig.ConfigReloading configEvent) { + public static void onFileChange(final ModConfig.Reloading configEvent) { LogManager.getLogger().fatal(CORE, "Forge config just got changed on the file system!"); } diff --git a/src/main/java/net/minecraftforge/fml/ResourceLocationUtils.java b/src/main/java/net/minecraftforge/fml/ResourceLocationUtils.java deleted file mode 100644 index c7bf80c50..000000000 --- a/src/main/java/net/minecraftforge/fml/ResourceLocationUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml; - -import com.google.common.base.Joiner; -import net.minecraft.util.ResourceLocation; - -import java.nio.file.Path; - -public class ResourceLocationUtils { - public static ResourceLocation pathToResourceLocation(Path path, int maxDepth) { - return new ResourceLocation(path.getName(0).toString(), Joiner.on("/").join(path.subpath(1, Math.min(maxDepth, path.getNameCount())).iterator())); - } -} diff --git a/src/main/java/net/minecraftforge/fml/StackTraceUtils.java b/src/main/java/net/minecraftforge/fml/StackTraceUtils.java deleted file mode 100644 index 88392b84d..000000000 --- a/src/main/java/net/minecraftforge/fml/StackTraceUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml; - -import java.util.Objects; - -public final class StackTraceUtils { - private StackTraceUtils() {} - - public static boolean threadClassNameEquals(final String className) { - final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); - return Objects.equals(stackTrace[stackTrace.length-1].getClassName(), className); - } -} diff --git a/src/main/java/net/minecraftforge/fml/StartupQuery.java b/src/main/java/net/minecraftforge/fml/StartupQuery.java index afb13435e..de36cc815 100644 --- a/src/main/java/net/minecraftforge/fml/StartupQuery.java +++ b/src/main/java/net/minecraftforge/fml/StartupQuery.java @@ -29,8 +29,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.server.MinecraftServer; import net.minecraft.server.dedicated.DedicatedServer; import net.minecraft.server.dedicated.PendingCommand; -import net.minecraftforge.fml.client.gui.GuiConfirmation; -import net.minecraftforge.fml.client.gui.GuiNotification; +import net.minecraftforge.fml.client.gui.screen.ConfirmationScreen; +import net.minecraftforge.fml.client.gui.screen.NotificationScreen; import net.minecraftforge.fml.common.thread.EffectiveSide; import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.fml.server.ServerLifecycleHooks; @@ -220,13 +220,13 @@ public class StartupQuery { return (query) -> { Minecraft client = clientSupplier.get(); if (query.getResult() == null) { - client.displayGuiScreen(new GuiNotification(query)); + client.displayGuiScreen(new NotificationScreen(query)); } else { - client.displayGuiScreen(new GuiConfirmation(query)); + client.displayGuiScreen(new ConfirmationScreen(query)); } if (query.isSynchronous()) { - while (client.currentScreen instanceof GuiNotification) { + while (client.currentScreen instanceof NotificationScreen) { if (Thread.interrupted()) { query.exception = new InterruptedException(); throw new RuntimeException(); diff --git a/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java b/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java index 662f18f05..9679143bf 100644 --- a/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java +++ b/src/main/java/net/minecraftforge/fml/client/ClientModLoader.java @@ -65,7 +65,7 @@ import net.minecraftforge.fml.ModLoadingStage; import net.minecraftforge.fml.ModLoadingWarning; import net.minecraftforge.fml.SidedProvider; import net.minecraftforge.fml.VersionChecker; -import net.minecraftforge.fml.client.gui.LoadingErrorScreen; +import net.minecraftforge.fml.client.gui.screen.LoadingErrorScreen; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.loading.moddiscovery.ModFile; import net.minecraftforge.fml.packs.DelegatableResourcePack; diff --git a/src/main/java/net/minecraftforge/fml/client/FMLConfigGuiFactory.java b/src/main/java/net/minecraftforge/fml/client/FMLConfigGuiFactory.java deleted file mode 100644 index adad48de6..000000000 --- a/src/main/java/net/minecraftforge/fml/client/FMLConfigGuiFactory.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* TODO is this ded? -package net.minecraftforge.fml.client; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.regex.Pattern; - -import com.google.common.collect.ImmutableSet; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.resources.I18n; -import net.minecraftforge.fml.client.config.ConfigGuiType; -import net.minecraftforge.fml.client.config.DummyConfigElement; -import net.minecraftforge.fml.client.config.GuiConfig; -import net.minecraftforge.fml.client.config.GuiEditArray; -import net.minecraftforge.fml.client.config.GuiEditArrayEntries; -import net.minecraftforge.fml.client.config.IConfigElement; -import net.minecraftforge.fml.client.config.DummyConfigElement.DummyCategoryElement; -import net.minecraftforge.fml.client.config.DummyConfigElement.DummyListElement; -import net.minecraftforge.fml.client.config.GuiConfigEntries.NumberSliderEntry; - -public class FMLConfigGuiFactory implements IModGuiFactory -{ - public static class FMLConfigGuiScreen extends GuiConfig - { - - public FMLConfigGuiScreen(GuiScreen parent) - { - super(parent, getConfigElements(), "FML", false, false, I18n.format("fml.config.sample.title")); - } - - private static List getConfigElements() - { - List list = new ArrayList(); - List listsList = new ArrayList(); - List stringsList = new ArrayList(); - List numbersList = new ArrayList(); - Pattern commaDelimitedPattern = Pattern.compile("([A-Za-z]+((,){1}( )*|$))+?"); - - // Top Level Settings - list.add(new DummyConfigElement("imABoolean", true, ConfigGuiType.BOOLEAN, "fml.config.sample.imABoolean").setRequiresMcRestart(true)); - list.add(new DummyConfigElement("imAnInteger", 42, ConfigGuiType.INTEGER, "fml.config.sample.imAnInteger", -1, 256).setRequiresMcRestart(true)); - list.add(new DummyConfigElement("imADouble", 42.4242D, ConfigGuiType.DOUBLE, "fml.config.sample.imADouble", -1.0D, 256.256D).setRequiresMcRestart(true)); - list.add(new DummyConfigElement("imAString", "http://www.montypython.net/scripts/string.php", ConfigGuiType.STRING, "fml.config.sample.imAString").setRequiresMcRestart(true)); - - // Lists category - listsList.add(new DummyListElement("booleanList", new Boolean[] {true, false, true, false, true, false, true, false}, ConfigGuiType.BOOLEAN, "fml.config.sample.booleanList")); - listsList.add(new DummyListElement("booleanListFixed", new Boolean[] {true, false, true, false, true, false, true, false}, ConfigGuiType.BOOLEAN, "fml.config.sample.booleanListFixed", true)); - listsList.add(new DummyListElement("booleanListMax", new Boolean[] {true, false, true, false, true, false, true, false}, ConfigGuiType.BOOLEAN, "fml.config.sample.booleanListMax", 10)); - listsList.add(new DummyListElement("doubleList", new Double[] {0.0D, 1.1D, 2.2D, 3.3D, 4.4D, 5.5D, 6.6D, 7.7D, 8.8D, 9.9D}, ConfigGuiType.DOUBLE, "fml.config.sample.doubleList")); - listsList.add(new DummyListElement("doubleListFixed", new Double[] {0.0D, 1.1D, 2.2D, 3.3D, 4.4D, 5.5D, 6.6D, 7.7D, 8.8D, 9.9D}, ConfigGuiType.DOUBLE, "fml.config.sample.doubleListFixed", true)); - listsList.add(new DummyListElement("doubleListMax", new Double[] {0.0D, 1.1D, 2.2D, 3.3D, 4.4D, 5.5D, 6.6D, 7.7D, 8.8D, 9.9D}, ConfigGuiType.DOUBLE, "fml.config.sample.doubleListMax", 15)); - listsList.add(new DummyListElement("doubleListBounded", new Double[] {0.0D, 1.1D, 2.2D, 3.3D, 4.4D, 5.5D, 6.6D, 7.7D, 8.8D, 9.9D}, ConfigGuiType.DOUBLE, "fml.config.sample.doubleListBounded", -1.0D, 10.0D)); - listsList.add(new DummyListElement("integerList", new Integer[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, ConfigGuiType.INTEGER, "fml.config.sample.integerList")); - listsList.add(new DummyListElement("integerListFixed", new Integer[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, ConfigGuiType.INTEGER, "fml.config.sample.integerListFixed", true)); - listsList.add(new DummyListElement("integerListMax", new Integer[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, ConfigGuiType.INTEGER, "fml.config.sample.integerListMax", 15)); - listsList.add(new DummyListElement("integerListBounded", new Integer[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, ConfigGuiType.INTEGER, "fml.config.sample.integerListBounded", -1, 10)); - listsList.add(new DummyListElement("stringList", new String[] {"An", "array", "of", "string", "values"}, ConfigGuiType.STRING, "fml.config.sample.stringList")); - listsList.add(new DummyListElement("stringListFixed", new String[] {"A", "fixed", "length", "array", "of", "string", "values"}, ConfigGuiType.STRING, "fml.config.sample.stringListFixed", true)); - listsList.add(new DummyListElement("stringListMax", new String[] {"An", "array", "of", "string", "values", "with", "a", "max", "length", "of", "15"}, ConfigGuiType.STRING, "fml.config.sample.stringListMax", 15)); - listsList.add(new DummyListElement("stringListPattern", new String[] {"Valid", "Not Valid", "Is, Valid", "Comma, Separated, Value"}, ConfigGuiType.STRING, "fml.config.sample.stringListPattern", commaDelimitedPattern)); - listsList.add(new DummyListElement("stringListCustom", new Object[0], ConfigGuiType.STRING, "fml.config.sample.stringListCustom").setArrayEntryClass(CustomArrayEntry.class)); - - list.add(new DummyCategoryElement("lists", "fml.config.sample.ctgy.lists", listsList)); - - // Strings category - stringsList.add(new DummyConfigElement("basicString", "Just a regular String value, anything goes.", ConfigGuiType.STRING, "fml.config.sample.basicString")); - stringsList.add(new DummyConfigElement("cycleString", "this", ConfigGuiType.STRING, "fml.config.sample.cycleString", new String[] {"this", "property", "cycles", "through", "a", "list", "of", "valid", "choices"})); - stringsList.add(new DummyConfigElement("patternString", "only, comma, separated, words, can, be, entered, in, this, box", ConfigGuiType.STRING, "fml.config.sample.patternString", commaDelimitedPattern)); - stringsList.add(new DummyConfigElement("chatColorPicker", "c", ConfigGuiType.COLOR, "fml.config.sample.chatColorPicker", new String[] {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"})); - stringsList.add(new DummyConfigElement("modIDSelector", "FML", ConfigGuiType.MOD_ID, "fml.config.sample.modIDSelector")); - - list.add(new DummyCategoryElement("strings", "fml.config.sample.ctgy.strings", stringsList)); - - // Numbers category - numbersList.add((new DummyConfigElement("basicInteger", 42, ConfigGuiType.INTEGER, "fml.config.sample.basicInteger"))); - numbersList.add((new DummyConfigElement("boundedInteger", 42, ConfigGuiType.INTEGER, "fml.config.sample.boundedInteger", -1, 256))); - numbersList.add((new DummyConfigElement("sliderInteger", 2000, ConfigGuiType.INTEGER, "fml.config.sample.sliderInteger", 100, 10000)).setCustomListEntryClass(NumberSliderEntry.class)); - numbersList.add(new DummyConfigElement("basicDouble", 42.4242D, ConfigGuiType.DOUBLE, "fml.config.sample.basicDouble")); - numbersList.add(new DummyConfigElement("boundedDouble", 42.4242D, ConfigGuiType.DOUBLE, "fml.config.sample.boundedDouble", -1.0D, 256.256D)); - numbersList.add(new DummyConfigElement("sliderDouble", 42.4242D, ConfigGuiType.DOUBLE, "fml.config.sample.sliderDouble", -1.0D, 256.256D).setCustomListEntryClass(NumberSliderEntry.class)); - - list.add(new DummyCategoryElement("numbers", "fml.config.sample.ctgy.numbers", numbersList)); - - return list; - } - } - - - @Override - public boolean hasConfigGui() - { - return true; - } - - public static class CustomArrayEntry extends GuiEditArrayEntries.StringEntry - { - public CustomArrayEntry(GuiEditArray owningScreen, GuiEditArrayEntries owningEntryList, IConfigElement configElement, Object value) - { - super(owningScreen, owningEntryList, configElement, value); - } - - @Override - public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float partial) - { - textFieldValue.setTextColor((int) (Math.random() * 0xFFFFFF)); - super.drawEntry(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected, partial); - } - } - - @Override - public void initialize(Minecraft minecraftInstance) - { - } - - @Override - public GuiScreen createConfigGui(GuiScreen parentScreen) - { - return new FMLConfigGuiScreen(parentScreen); - } - - private static final Set fmlCategories = ImmutableSet.of(new RuntimeOptionCategoryElement("HELP", "FML")); - - @Override - public Set runtimeGuiCategories() - { - return fmlCategories; - } -} -*/ \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fml/client/IModGuiFactory.java b/src/main/java/net/minecraftforge/fml/client/IModGuiFactory.java deleted file mode 100644 index 4d8edbecb..000000000 --- a/src/main/java/net/minecraftforge/fml/client/IModGuiFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client; - -import java.util.Set; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screen.Screen; - -/** - * This is the interface you need to implement if you want to provide a customized config screen. - * {@link DefaultGuiFactory} provides a default implementation of this interface and will be used - * if the mod does not specify anything else. - */ -public interface IModGuiFactory { - /** - * Called when instantiated to initialize with the active minecraft instance. - * - * @param minecraftInstance the instance - */ - void initialize(Minecraft minecraftInstance); - - /** - * If this method returns false, the config button in the mod list will be disabled - * @return true if this object provides a config gui screen, false otherwise - */ - boolean hasConfigGui(); - - /** - * Return an initialized {@link GuiScreen}. This screen will be displayed - * when the "config" button is pressed in the mod list. It will - * have a single argument constructor - the "parent" screen, the same as all - * Minecraft GUIs. The expected behaviour is that this screen will replace the - * "mod list" screen completely, and will return to the mod list screen through - * the parent link, once the appropriate action is taken from the config screen. - * - * This config GUI is anticipated to provide configuration to the mod in a friendly - * visual way. It should not be abused to set internals such as IDs (they're gonna - * keep disappearing anyway), but rather, interesting behaviours. This config GUI - * is never run when a server game is running, and should be used to configure - * desired behaviours that affect server state. Costs, mod game modes, stuff like that - * can be changed here. - * - * @param parentScreen The screen to which must be returned when closing the - * returned screen. - * @return A class that will be instantiated on clicks on the config button - * or null if no GUI is desired. - */ - Screen createConfigGui(Screen parentScreen); - - /** - * Return a list of the "runtime" categories this mod wishes to populate with - * GUI elements. - * - * Runtime categories are created on demand and organized in a 'lite' tree format. - * The parent represents the parent node in the tree. There is one special parent - * 'Help' that will always list first, and is generally meant to provide Help type - * content for mods. The remaining parents will sort alphabetically, though - * this may change if there is a lot of alphabetic abuse. "AAA" is probably never a valid - * category parent. - * - * Runtime configuration itself falls into two flavours: in-game help, which is - * generally non interactive except for the text it wishes to show, and client-only - * affecting behaviours. This would include things like toggling minimaps, or cheat modes - * or anything NOT affecting the behaviour of the server. Please don't abuse this to - * change the state of the server in any way, this is intended to behave identically - * when the server is local or remote. - * - * @return the set of options this mod wishes to have available, or empty if none - */ - Set runtimeGuiCategories(); - - /** - * Represents an option category and entry in the runtime gui options list. - * - * @author cpw - * - */ - public static class RuntimeOptionCategoryElement { - public final String parent; - public final String child; - - public RuntimeOptionCategoryElement(String parent, String child) - { - this.parent = parent; - this.child = child; - } - } -} diff --git a/src/main/java/net/minecraftforge/fml/client/TextureTracker.java b/src/main/java/net/minecraftforge/fml/client/TextureTracker.java deleted file mode 100644 index bee3eb0bb..000000000 --- a/src/main/java/net/minecraftforge/fml/client/TextureTracker.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.SetMultimap; -import com.google.common.collect.Sets; -import com.google.common.collect.Table; -import net.minecraft.util.ResourceLocation; - -import java.util.Set; - -public class TextureTracker -{ - private static final SetMultimap missingTextures = HashMultimap.create(); - private static final Set badTextureDomains = Sets.newHashSet(); - private static final Table> brokenTextures = HashBasedTable.create(); - - public static void trackMissingTexture(ResourceLocation resourceLocation) - { - badTextureDomains.add(resourceLocation.getNamespace()); - missingTextures.put(resourceLocation.getNamespace(),resourceLocation); - } - - public static void trackBrokenTexture(ResourceLocation resourceLocation, String error) - { - badTextureDomains.add(resourceLocation.getNamespace()); - Set badType = brokenTextures.get(resourceLocation.getNamespace(), error); - if (badType == null) - { - badType = Sets.newHashSet(); - brokenTextures.put(resourceLocation.getNamespace(), MoreObjects.firstNonNull(error, "Unknown error"), badType); - } - badType.add(resourceLocation); - } -} diff --git a/src/main/java/net/minecraftforge/fml/client/config/ConfigGuiType.java b/src/main/java/net/minecraftforge/fml/client/config/ConfigGuiType.java deleted file mode 100644 index e090a695b..000000000 --- a/src/main/java/net/minecraftforge/fml/client/config/ConfigGuiType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.config; - -public enum ConfigGuiType -{ - STRING, - INTEGER, - BOOLEAN, - DOUBLE, - COLOR, - MOD_ID, - CONFIG_CATEGORY; -} diff --git a/src/main/java/net/minecraftforge/fml/client/config/DummyConfigElement.java b/src/main/java/net/minecraftforge/fml/client/config/DummyConfigElement.java deleted file mode 100644 index 3a7a23b0d..000000000 --- a/src/main/java/net/minecraftforge/fml/client/config/DummyConfigElement.java +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.config; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Pattern; - -import javax.annotation.Nullable; - -import net.minecraft.client.resources.I18n; - - -/** - * This class's main purpose is to provide the necessary objects for a sample Config GUI for FML, although - * there may be practical uses for the objects defined here such as using the DummyCategoryElement object as a - * wrapper for a custom IGuiConfigListEntry object that opens a special screen. - * - * @author bspkrs - */ -public class DummyConfigElement implements IConfigElement -{ - protected boolean isProperty = true; - protected boolean isList = false; - protected ConfigGuiType type; - protected String name; - protected String langKey; - protected Object value; - protected Object defaultValue; - protected Object[] values; - protected Object[] defaultValues; - protected String[] validValues; - protected Pattern validStringPattern; - protected Object minValue; - protected Object maxValue; - protected boolean requiresWorldRestart = false; - protected boolean requiresMcRestart = false; - protected boolean isListFixedLength = false; - protected int maxListLength = -1; - protected List childElements; - @Nullable - protected Class configEntryClass; - protected Class arrayEntryClass; - - /** - * This class provides a Dummy Category IConfigElement. It can be used to define a custom list of GUI entries that will - * appear on the child screen or to specify a custom IGuiConfigListEntry for a special category. - */ - public static class DummyCategoryElement extends DummyConfigElement - { - public DummyCategoryElement(String name, String langKey, List childElements) - { - this(name, langKey, childElements, null); - } - - public DummyCategoryElement(String name, String langKey, Class customListEntryClass) - { - this(name, langKey, new ArrayList(), customListEntryClass); - } - - public DummyCategoryElement(String name, String langKey, List childElements, @Nullable Class customListEntryClass) - { - super(name, null, ConfigGuiType.CONFIG_CATEGORY, langKey); - this.childElements = childElements; - this.configEntryClass = customListEntryClass; - isProperty = false; - } - } - - /** - * This class provides a dummy array-type IConfigElement. - */ - public static class DummyListElement extends DummyConfigElement - { - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, int maxListLength, @Nullable Pattern validStringPattern, @Nullable Object minValue, @Nullable Object maxValue) - { - super(name, null, type, langKey, minValue, maxValue); - this.defaultValues = defaultValues; - this.values = defaultValues; - this.isListFixedLength = isListFixedLength; - this.maxListLength = maxListLength; - this.validStringPattern = validStringPattern; - isList = true; - } - - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey) - { - this(name, defaultValues, type, langKey, false, -1, null, null, null); - } - - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength) - { - this(name, defaultValues, type, langKey, isListFixedLength, -1, null, null, null); - } - - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, int maxListLength) - { - this(name, defaultValues, type, langKey, false, maxListLength, null, null, null); - } - - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, Object minValue, Object maxValue) - { - this(name, defaultValues, type, langKey, false, -1, null, minValue, maxValue); - } - - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, Object minValue, Object maxValue) - { - this(name, defaultValues, type, langKey, isListFixedLength, -1, null, minValue, maxValue); - } - - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, int maxListLength, Object minValue, Object maxValue) - { - this(name, defaultValues, type, langKey, false, maxListLength, null, minValue, maxValue); - } - - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, int maxListLength, Object minValue, Object maxValue) - { - this(name, defaultValues, type, langKey, isListFixedLength, maxListLength, null, minValue, maxValue); - } - - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, Pattern validStringPattern) - { - this(name, defaultValues, type, langKey, false, -1, validStringPattern, null, null); - } - - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, Pattern validStringPattern) - { - this(name, defaultValues, type, langKey, isListFixedLength, -1, validStringPattern, null, null); - } - - public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, int maxListLength, Pattern validStringPattern) - { - this(name, defaultValues, type, langKey, false, maxListLength, validStringPattern, null, null); - } - - public DummyListElement setCustomEditListEntryClass(Class clazz) - { - this.arrayEntryClass = clazz; - return this; - } - - @Override - public Object getDefault() - { - return Arrays.toString(this.defaultValues); - } - } - - public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey, String[] validValues, Pattern validStringPattern, Object minValue, Object maxValue) - { - this.name = name; - this.defaultValue = defaultValue; - this.value = defaultValue; - this.type = type; - this.langKey = langKey; - this.validValues = validValues; - this.validStringPattern = validStringPattern; - if (minValue == null) - { - if (type == ConfigGuiType.INTEGER) - this.minValue = Integer.MIN_VALUE; - else if (type == ConfigGuiType.DOUBLE) - this.minValue = -Double.MAX_VALUE; - } - else - this.minValue = minValue; - if (maxValue == null) - { - if (type == ConfigGuiType.INTEGER) - this.maxValue = Integer.MAX_VALUE; - else if (type == ConfigGuiType.DOUBLE) - this.maxValue = Double.MAX_VALUE; - } - else - this.maxValue = maxValue; - } - - public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey, Pattern validStringPattern) - { - this(name, defaultValue, type, langKey, null, validStringPattern, null, null); - } - - public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey, String[] validValues) - { - this(name, defaultValue, type, langKey, validValues, null, null, null); - } - - public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey) - { - this(name, defaultValue, type, langKey, null, null, null, null); - } - - public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey, Object minValue, Object maxValue) - { - this(name, defaultValue, type, langKey, null, null, minValue, maxValue); - } - - public DummyConfigElement setCustomListEntryClass(Class clazz) - { - this.configEntryClass = clazz; - return this; - } - - @Override - public boolean isProperty() - { - return isProperty; - } - - public IConfigElement setConfigEntryClass(Class clazz) - { - this.configEntryClass = clazz; - return this; - } - - @Override - public Class getConfigEntryClass() - { - return configEntryClass; - } - - public IConfigElement setArrayEntryClass(Class clazz) - { - this.arrayEntryClass = clazz; - return this; - } - - @Override - public Class getArrayEntryClass() - { - return arrayEntryClass; - } - - @Override - public String getName() - { - return name; - } - - @Override - public String getQualifiedName() - { - return name; - } - - @Override - public String getLanguageKey() - { - return langKey; - } - - @Override - public String getComment() - { - return I18n.format(langKey + ".tooltip"); - } - - @Override - public List getChildElements() - { - return childElements; - } - - @Override - public ConfigGuiType getType() - { - return type; - } - - @Override - public boolean isList() - { - return isList; - } - - @Override - public boolean isListLengthFixed() - { - return this.isListFixedLength; - } - - @Override - public int getMaxListLength() - { - return this.maxListLength; - } - - @Override - public boolean isDefault() - { - if (isProperty) - { - if (!isList) - { - if (value != null) - return value.equals(defaultValue); - else - return defaultValue == null; - } - else - { - return Arrays.deepEquals(values, defaultValues); - } - } - - return true; - } - - @Override - public Object getDefault() - { - return defaultValue; - } - - @Override - public Object[] getDefaults() - { - return defaultValues; - } - - @Override - public void setToDefault() - { - if (isList) - this.values = Arrays.copyOf(this.defaultValues, this.defaultValues.length); - else - this.value = defaultValue; - } - - public IConfigElement setRequiresWorldRestart(boolean requiresWorldRestart) - { - this.requiresWorldRestart = requiresWorldRestart; - return this; - } - - @Override - public boolean requiresWorldRestart() - { - return requiresWorldRestart; - } - - @Override - public boolean showInGui() - { - return true; - } - - public IConfigElement setRequiresMcRestart(boolean requiresMcRestart) - { - this.requiresMcRestart = this.requiresWorldRestart = requiresMcRestart; - return this; - } - - @Override - public boolean requiresMcRestart() - { - return requiresMcRestart; - } - - @Override - public String[] getValidValues() - { - return validValues; - } - - @Override - public Pattern getValidationPattern() - { - return validStringPattern; - } - - @Override - public Object get() - { - return value; - } - - @Override - public Object[] getList() - { - return values; - } - - @Override - public void set(Object value) - { - defaultValue = value; - } - - @Override - public void set(Object[] aVal) - { - defaultValues = aVal; - } - - @Override - public Object getMinValue() - { - return minValue; - } - - @Override - public Object getMaxValue() - { - return maxValue; - } -} diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiCheckBox.java b/src/main/java/net/minecraftforge/fml/client/config/GuiCheckBox.java deleted file mode 100644 index c857e18a8..000000000 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiCheckBox.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.config; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.widget.button.Button; - -/** - * This class provides a checkbox style control. - */ -public class GuiCheckBox extends Button -{ - private boolean isChecked; - private int boxWidth; - - public GuiCheckBox(int xPos, int yPos, String displayString, boolean isChecked) - { - super(xPos, yPos, Minecraft.getInstance().fontRenderer.getStringWidth(displayString) + 2 + 11, 11, displayString, b -> {}); - this.isChecked = isChecked; - } - - @Override - public void renderButton(int mouseX, int mouseY, float partial) - { - super.renderButton(mouseX, mouseY, partial); - if (this.isChecked) - this.drawCenteredString(Minecraft.getInstance().fontRenderer, "x", this.x + this.boxWidth / 2 + 1, this.y + 1, 14737632); - } - - @Override - public void onPress() - { - this.isChecked = !this.isChecked; - } - - public boolean isChecked() - { - return this.isChecked; - } - - public void setIsChecked(boolean isChecked) - { - this.isChecked = isChecked; - } -} diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java b/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java deleted file mode 100644 index e908d5d7f..000000000 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiMessageDialog.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.config; - -import net.minecraft.client.gui.screen.DisconnectedScreen; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.text.ITextComponent; - -import javax.annotation.Nullable; - -public class GuiMessageDialog extends DisconnectedScreen -{ - protected String buttonText; - - public GuiMessageDialog(@Nullable Screen nextScreen, String title, ITextComponent message, String buttonText) - { - super(nextScreen, title, message); - this.buttonText = I18n.format(buttonText); - } -} diff --git a/src/main/java/net/minecraftforge/fml/client/config/IArrayEntry.java b/src/main/java/net/minecraftforge/fml/client/config/IArrayEntry.java deleted file mode 100644 index 01210f4e8..000000000 --- a/src/main/java/net/minecraftforge/fml/client/config/IArrayEntry.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.config; - -public interface IArrayEntry -{ - void keyTyped(char eventChar, int eventKey); - - void updateCursorCounter(); - - void mouseClicked(int x, int y, int mouseEvent); - - void drawToolTip(int mouseX, int mouseY); - - boolean isValueSavable(); - - Object getValue(); -} diff --git a/src/main/java/net/minecraftforge/fml/client/config/IConfigElement.java b/src/main/java/net/minecraftforge/fml/client/config/IConfigElement.java deleted file mode 100644 index f44b2497b..000000000 --- a/src/main/java/net/minecraftforge/fml/client/config/IConfigElement.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.config; - -import java.util.List; -import java.util.regex.Pattern; - -/** - * This interface provides the information needed by GuiConfig and GuiConfigEntries to display config elements for editing. - * - * @author bspkrs - */ -public interface IConfigElement -{ - /** - * [Property, Category] Is this object a property object? - */ - boolean isProperty(); - - /** - * This method returns a class that implements {@link IConfigEntry} or null. This class MUST - * provide a constructor with the following parameter types: {@link GuiConfig}, {@link GuiConfigEntries}, {@link IConfigElement} - * - * @see GuiConfigEntries.ListEntryBase - * @see GuiConfigEntries.StringEntry - * @see GuiConfigEntries.BooleanEntry - * @see GuiConfigEntries.DoubleEntry - * @see GuiConfigEntries.IntegerEntry - */ - Class getConfigEntryClass(); - - /** - * This method returns a class that implements {@link IArrayEntry}. This class MUST provide a constructor with the - * following parameter types: {@link GuiEditArray}, {@link GuiEditArrayEntries}, {@link IConfigElement}, {@link Object} - * - * @see GuiEditArrayEntries.BaseEntry - * @see GuiEditArrayEntries.StringEntry - * @see GuiEditArrayEntries.BooleanEntry - * @see GuiEditArrayEntries.DoubleEntry - * @see GuiEditArrayEntries.IntegerEntry - */ - Class getArrayEntryClass(); - - /** - * [Property, Category] Gets the name of this object. - */ - String getName(); - - /** - * [Category] Gets the qualified name of this object. This is typically only used for category objects. - */ - String getQualifiedName(); - - /** - * [Property, Category] Gets a language key for localization of config GUI entry names. If the same key is specified with .tooltip - * appended to the end, that key will return a localized tooltip when the mouse hovers over the property label/category button. - */ - String getLanguageKey(); - - /** - * [Property, Category] Gets the comment for this object. Used for the tooltip if getLanguageKey() + ".tooltip" is not defined in the - * .lang file. - */ - String getComment(); - - /** - * [Category] Gets this category's child categories/properties. - */ - List getChildElements(); - - /** - * [Property, Category] Gets the ConfigGuiType value corresponding to the type of this property object, or CONFIG_CATEGORY if this is a - * category object. - */ - ConfigGuiType getType(); - - /** - * [Property] Is this property object a list? - */ - boolean isList(); - - /** - * [Property] Does this list property have to remain a fixed length? - */ - boolean isListLengthFixed(); - - /** - * [Property] Gets the max length of this list property, or -1 if the length is unlimited. - */ - int getMaxListLength(); - - /** - * [Property] Is this property value equal to the default value? - */ - boolean isDefault(); - - /** - * [Property] Gets this property's default value. If this element is an array, this method should return a String - * representation of that array using Arrays.toString() - */ - Object getDefault(); - - /** - * [Property] Gets this property's default values. - */ - Object[] getDefaults(); - - /** - * [Property] Sets this property's value to the default value. - */ - void setToDefault(); - - /** - * [Property, Category] Whether or not this element is safe to modify while a world is running. For Categories return false if ANY properties - * in the category are modifiable while a world is running, true if all are not. - */ - boolean requiresWorldRestart(); - - /** - * [Property, Category] Whether or not this element should be allowed to show on config GUIs. - */ - boolean showInGui(); - - /** - * [Property, Category] Whether or not this element requires Minecraft to be restarted when changed. - */ - boolean requiresMcRestart(); - - /** - * [Property] Gets this property value. - */ - Object get(); - - /** - * [Property] Gets this property value as a list. Generally you should be sure of whether the property is a list before calling this. - */ - Object[] getList(); - - /** - * [Property] Sets this property's value. - */ - void set(Object value); - - /** - * [Property] Sets this property's value to the specified array. - */ - void set(Object[] aVal); - - /** - * [Property] Gets a String array of valid values for this property. This is generally used for String properties to allow the user to - * select a value from a list of valid values. - */ - String[] getValidValues(); - - /** - * [Property] Gets this property's minimum value. - */ - Object getMinValue(); - - /** - * [Property] Gets this property's maximum value. - */ - Object getMaxValue(); - - /** - * [Property] Gets a Pattern object used in String property input validation. - */ - Pattern getValidationPattern(); -} diff --git a/src/main/java/net/minecraftforge/fml/client/config/IConfigEntry.java b/src/main/java/net/minecraftforge/fml/client/config/IConfigEntry.java deleted file mode 100644 index c34d09d1e..000000000 --- a/src/main/java/net/minecraftforge/fml/client/config/IConfigEntry.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.config; - -/** - * Provides an interface for defining GuiConfigEntry.listEntry objects. - */ -public interface IConfigEntry -{ - /** - * Gets the IConfigElement object owned by this entry. - * @return - */ - IConfigElement getConfigElement(); - - /** - * Gets the name of the ConfigElement owned by this entry. - */ - String getName(); - - /** - * Gets the current value of this entry. - */ - Object getCurrentValue(); - - /** - * Gets the current values of this list entry. - */ - Object[] getCurrentValues(); - - /** - * Is this list entry enabled? - * - * @return true if this entry's controls should be enabled, false otherwise. - */ - boolean enabled(); - - /** - * Handles user keystrokes for any GuiTextField objects in this entry. Call {@link GuiTextField#textboxKeyTyped(char, int)} for any GuiTextField - * objects that should receive the input provided. - */ - void keyTyped(char eventChar, int eventKey); - - /** - * Call {@link GuiTextField#updateCursorCounter()} for any GuiTextField objects in this entry. - */ - void updateCursorCounter(); - - /** - * Call {@link GuiTextField#mouseClicked(int, int, int)} for and GuiTextField objects in this entry. - */ - void mouseClicked(int x, int y, int mouseEvent); - - /** - * Is this entry's value equal to the default value? Generally true should be returned if this entry is not a property or category - * entry. - * - * @return true if this entry's value is equal to this entry's default value. - */ - boolean isDefault(); - - /** - * Sets this entry's value to the default value. - */ - void setToDefault(); - - /** - * Handles reverting any changes that have occurred to this entry. - */ - void undoChanges(); - - /** - * Has the value of this entry changed? - * - * @return true if changes have been made to this entry's value, false otherwise. - */ - boolean isChanged(); - - /** - * Handles saving any changes that have been made to this entry back to the underlying object. It is a good practice to check - * isChanged() before performing the save action. This method should return true if the element has changed AND REQUIRES A RESTART. - */ - boolean saveConfigElement(); - - /** - * Handles drawing any tooltips that apply to this entry. This method is called after all other GUI elements have been drawn to the - * screen, so it could also be used to draw any GUI element that needs to be drawn after all entries have had drawEntry() called. - */ - void drawToolTip(int mouseX, int mouseY); - - /** - * Gets this entry's label width. - */ - int getLabelWidth(); - - /** - * Gets this entry's right-hand x boundary. This value is used to control where the scroll bar is placed. - */ - int getEntryRightBound(); - - /** - * This method is called when the parent GUI is closed. Most handlers won't need this; it is provided for special cases. - */ - void onGuiClosed(); -} diff --git a/src/main/java/net/minecraftforge/fml/client/event/ConfigChangedEvent.java b/src/main/java/net/minecraftforge/fml/client/event/ConfigChangedEvent.java deleted file mode 100644 index e55ea911a..000000000 --- a/src/main/java/net/minecraftforge/fml/client/event/ConfigChangedEvent.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.event; - -import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.eventbus.api.Event.HasResult; - -import javax.annotation.Nullable; - -/** - * These events are posted from the GuiConfig screen when the done button is pressed. The events are only posted - * if the parent screen is not an instance of GuiConfig or if the configID field has been set for - * the GuiConfig screen. - * - * Listeners for this event should use OnConfigChanged or PostConfigChanged and check for a specific mod ID. - * For best results the listener should refresh any objects/fields that are set based on the mod's config - * and should serialize the modified config. - * - * @author bspkrs - */ -@HasResult -public class ConfigChangedEvent extends net.minecraftforge.eventbus.api.Event -{ - private final String modID; - private final boolean isWorldRunning; - private final boolean requiresMcRestart; - @Nullable - private final String configID; - - public ConfigChangedEvent(String modID, @Nullable String configID, boolean isWorldRunning, boolean requiresMcRestart) - { - this.modID = modID; - this.configID = configID; - this.isWorldRunning = isWorldRunning; - this.requiresMcRestart = requiresMcRestart; - } - - /** - * The Mod ID of the mod whose configuration just changed. - */ - public String getModID() - { - return modID; - } - - /** - * Whether or not a world is currently running. - */ - public boolean isWorldRunning() - { - return isWorldRunning; - } - - /** - * Will be set to true if any elements were changed that require a restart of Minecraft. - */ - public boolean isRequiresMcRestart() - { - return requiresMcRestart; - } - - /** - * A String identifier for this ConfigChangedEvent. - */ - @Nullable - public String getConfigID() - { - return configID; - } - - /** - * This event is intended to be consumed by the mod whose config has been changed. It fires when the Done button - * has been clicked on a GuiConfig screen and the following conditions are met:
- * - at least one config element has been changed
- * - one of these 2 conditions are met:
- * 1) the parent screen is null or is not an instance of GuiConfig
- * 2) the configID field has been set to a non-null value for the GuiConfig screen

- * Modders should check the modID field of the event to ensure they are only acting on their own config screen's event! - */ - public static class OnConfigChangedEvent extends ConfigChangedEvent - { - public OnConfigChangedEvent(String modID, @Nullable String configID, boolean isWorldRunning, boolean requiresMcRestart) - { - super(modID, configID, isWorldRunning, requiresMcRestart); - } - } - - /** - * This event is provided for mods to consume if they want to be able to check if other mods' configs have been changed. - * This event only fires if the OnConfigChangedEvent result is not DENY. - */ - public static class PostConfigChangedEvent extends ConfigChangedEvent - { - public PostConfigChangedEvent(String modID, @Nullable String configID, boolean isWorldRunning, boolean requiresMcRestart) - { - super(modID, configID, isWorldRunning, requiresMcRestart); - } - } -} diff --git a/src/main/java/net/minecraftforge/fml/client/gui/GuiAccessDenied.java b/src/main/java/net/minecraftforge/fml/client/gui/GuiAccessDenied.java deleted file mode 100644 index 14206085d..000000000 --- a/src/main/java/net/minecraftforge/fml/client/gui/GuiAccessDenied.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.gui; - -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.text.TranslationTextComponent; - -public class GuiAccessDenied extends Screen -{ - private Screen parent; - private ServerData data; - public GuiAccessDenied(Screen parent, ServerData data) - { - super(new TranslationTextComponent("fml.menu.accessdenied.title")); - this.parent = parent; - this.data = data; - } - - @Override - public void init() - { - this.buttons.add(new Button(this.width / 2 - 75, this.height - 38, 200, 20, I18n.format("gui.done"), b -> GuiAccessDenied.this.minecraft.displayGuiScreen(parent))); - } - - @Override - public void render(int mouseX, int mouseY, float partialTicks) - { - this.renderBackground(); - String[] lines = I18n.format("fml.menu.accessdenied.message", data.serverName).split("\n"); - int offset = Math.max(85 - lines.length * 10, 10); - for (String line : lines) { - this.drawCenteredString(this.font, line, this.width / 2, offset, 0xFFFFFF); - offset += 10; - } - super.render(mouseX, mouseY, partialTicks); - } -} diff --git a/src/main/java/net/minecraftforge/fml/client/gui/GuiBackupFailed.java b/src/main/java/net/minecraftforge/fml/client/gui/GuiBackupFailed.java deleted file mode 100644 index 0129a7421..000000000 --- a/src/main/java/net/minecraftforge/fml/client/gui/GuiBackupFailed.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.client.gui; - -import java.io.File; -import net.minecraft.client.gui.widget.button.Button; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.text.TranslationTextComponent; - -public class GuiBackupFailed extends Screen -{ - private Screen parent; - private File zipName; - public GuiBackupFailed(Screen parent, File zipName) - { - super(new TranslationTextComponent("fml.menu.backupfailed.title")); - this.parent = parent; - this.zipName = zipName; - } - - @Override - public void init() - { - this.buttons.add(new Button(this.width / 2 - 75, this.height - 38, 200, 20, I18n.format("gui.done"), b -> GuiBackupFailed.this.minecraft.displayGuiScreen(parent))); - } - - @Override - public void render(int mouseX, int mouseY, float partialTicks) - { - this.renderBackground(); - String[] lines = I18n.format("fml.menu.backupfailed.message", zipName.getName()).split("\n"); - int offset = Math.max(85 - lines.length * 10, 10); - for (String line : lines) { - this.drawCenteredString(this.font, line, this.width / 2, offset, 0xFFFFFF); - offset += 10; - } - super.render(mouseX, mouseY, partialTicks); - } -} diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java b/src/main/java/net/minecraftforge/fml/client/gui/GuiUtils.java similarity index 99% rename from src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java rename to src/main/java/net/minecraftforge/fml/client/gui/GuiUtils.java index 808d91ea6..cccd153c5 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/GuiUtils.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.fml.client.config; +package net.minecraftforge.fml.client.gui; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/src/main/java/net/minecraftforge/fml/client/config/HoverChecker.java b/src/main/java/net/minecraftforge/fml/client/gui/HoverChecker.java similarity index 86% rename from src/main/java/net/minecraftforge/fml/client/config/HoverChecker.java rename to src/main/java/net/minecraftforge/fml/client/gui/HoverChecker.java index 7406854e7..8e2bef738 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/HoverChecker.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/HoverChecker.java @@ -17,9 +17,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.fml.client.config; +package net.minecraftforge.fml.client.gui; -import net.minecraft.client.gui.widget.button.Button; +import net.minecraft.client.gui.widget.Widget; /** * This class implements an easy way to check if the mouse has hovered within a certain region of the screen for a given @@ -30,7 +30,7 @@ import net.minecraft.client.gui.widget.button.Button; public class HoverChecker { private int top, bottom, left, right, threshold; - private Button button; + private Widget widget; private long hoverStart; public HoverChecker(int top, int bottom, int left, int right, int threshold) @@ -43,9 +43,9 @@ public class HoverChecker this.hoverStart = -1; } - public HoverChecker(Button button, int threshold) + public HoverChecker(Widget widget, int threshold) { - this.button = button; + this.widget = widget; this.threshold = threshold; } @@ -76,13 +76,13 @@ public class HoverChecker */ public boolean checkHover(int mouseX, int mouseY, boolean canHover) { - if (this.button != null) + if (this.widget != null) { - this.top = button.y; - this.bottom = button.y + button.getHeight(); - this.left = button.x; - this.right = button.x + button.getWidth(); - canHover = canHover && button.visible; + this.top = widget.y; + this.bottom = widget.y + widget.getHeight(); + this.left = widget.x; + this.right = widget.x + widget.getWidth(); + canHover = canHover && widget.visible; } if (canHover && hoverStart == -1 && mouseY >= top && mouseY <= bottom && mouseX >= left && mouseX <= right) diff --git a/src/main/java/net/minecraftforge/fml/client/gui/GuiConfirmation.java b/src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java similarity index 82% rename from src/main/java/net/minecraftforge/fml/client/gui/GuiConfirmation.java rename to src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java index 38c0090fb..37f817fb9 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/GuiConfirmation.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java @@ -17,14 +17,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.fml.client.gui; +package net.minecraftforge.fml.client.gui.screen; import net.minecraft.client.gui.widget.button.Button; import net.minecraftforge.fml.ForgeI18n; import net.minecraftforge.fml.StartupQuery; -public class GuiConfirmation extends GuiNotification +public class ConfirmationScreen extends NotificationScreen { - public GuiConfirmation(StartupQuery query) + public ConfirmationScreen(StartupQuery query) { super(query); } @@ -34,14 +34,14 @@ public class GuiConfirmation extends GuiNotification { this.addButton(new Button(this.width / 2 - 104, this.height - 38, 100, 20, ForgeI18n.parseMessage("gui.yes"), b -> { - GuiConfirmation.this.minecraft.currentScreen = null; + ConfirmationScreen.this.minecraft.currentScreen = null; query.setResult(true); query.finish(); } )); this.addButton(new Button(this.width / 2 + 4, this.height - 38, 100, 20, ForgeI18n.parseMessage("gui.no"), b -> { - GuiConfirmation.this.minecraft.currentScreen = null; + ConfirmationScreen.this.minecraft.currentScreen = null; query.setResult(false); query.finish(); } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/LoadingErrorScreen.java b/src/main/java/net/minecraftforge/fml/client/gui/screen/LoadingErrorScreen.java similarity index 90% rename from src/main/java/net/minecraftforge/fml/client/gui/LoadingErrorScreen.java rename to src/main/java/net/minecraftforge/fml/client/gui/screen/LoadingErrorScreen.java index aa060d625..544e56866 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/LoadingErrorScreen.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/screen/LoadingErrorScreen.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.fml.client.gui; +package net.minecraftforge.fml.client.gui.screen; import com.google.common.base.Strings; import net.minecraft.client.Minecraft; @@ -32,7 +32,7 @@ import net.minecraftforge.fml.LoadingFailedException; import net.minecraftforge.fml.ModLoadingException; import net.minecraftforge.fml.ModLoadingWarning; import net.minecraftforge.fml.client.ClientHooks; -import net.minecraftforge.fml.client.config.GuiButtonExt; +import net.minecraftforge.fml.client.gui.widget.ExtendedButton; import net.minecraftforge.fml.loading.FMLPaths; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -73,10 +73,10 @@ public class LoadingErrorScreen extends ErrorScreen { this.warningHeader = TextFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadErrors.size()) + TextFormatting.RESET; int yOffset = this.modLoadErrors.isEmpty() ? 46 : 38; - this.addButton(new GuiButtonExt(50, this.height - yOffset, this.width / 2 - 55, 20, ForgeI18n.parseMessage("fml.button.open.mods.folder"), b -> Util.getOSType().openFile(modsDir.toFile()))); - this.addButton(new GuiButtonExt(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName()), b -> Util.getOSType().openFile(logFile.toFile()))); + this.addButton(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, ForgeI18n.parseMessage("fml.button.open.mods.folder"), b -> Util.getOSType().openFile(modsDir.toFile()))); + this.addButton(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName()), b -> Util.getOSType().openFile(logFile.toFile()))); if (this.modLoadErrors.isEmpty()) { - this.addButton(new GuiButtonExt(this.width / 4, this.height - 24, this.width / 2, 20, ForgeI18n.parseMessage("fml.button.continue.launch"), b -> { + this.addButton(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, ForgeI18n.parseMessage("fml.button.continue.launch"), b -> { ClientHooks.logMissingTextureErrors(); this.minecraft.displayGuiScreen(null); })); diff --git a/src/main/java/net/minecraftforge/fml/client/gui/ModListScreen.java b/src/main/java/net/minecraftforge/fml/client/gui/screen/ModListScreen.java similarity index 98% rename from src/main/java/net/minecraftforge/fml/client/gui/ModListScreen.java rename to src/main/java/net/minecraftforge/fml/client/gui/screen/ModListScreen.java index 1314b3871..7662fcea4 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/ModListScreen.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/screen/ModListScreen.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.fml.client.gui; +package net.minecraftforge.fml.client.gui.screen; import java.io.IOException; import java.io.InputStream; @@ -63,7 +63,8 @@ import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.VersionChecker; import net.minecraftforge.fml.client.ConfigGuiHandler; -import net.minecraftforge.fml.client.config.GuiUtils; +import net.minecraftforge.fml.client.gui.GuiUtils; +import net.minecraftforge.fml.client.gui.widget.ModListWidget; import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.fml.loading.StringUtils; import net.minecraftforge.fml.loading.moddiscovery.ModInfo; @@ -389,12 +390,12 @@ public class ModListScreen extends Screen super.render(mouseX, mouseY, partialTicks); } - Minecraft getMinecraftInstance() + public Minecraft getMinecraftInstance() { return minecraft; } - FontRenderer getFontRenderer() + public FontRenderer getFontRenderer() { return font; } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/GuiNotification.java b/src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java similarity index 91% rename from src/main/java/net/minecraftforge/fml/client/gui/GuiNotification.java rename to src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java index 05bed704c..5b96f14fc 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/GuiNotification.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.fml.client.gui; +package net.minecraftforge.fml.client.gui.screen; import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.screen.Screen; @@ -25,9 +25,9 @@ import net.minecraft.client.resources.I18n; import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.fml.StartupQuery; -public class GuiNotification extends Screen +public class NotificationScreen extends Screen { - public GuiNotification(StartupQuery query) + public NotificationScreen(StartupQuery query) { super(new TranslationTextComponent("fml.menu.notification.title")); this.query = query; @@ -37,7 +37,7 @@ public class GuiNotification extends Screen public void init() { this.buttons.add(new Button(this.width / 2 - 100, this.height - 38, 200, 20, I18n.format("gui.done"), b -> { - GuiNotification.this.minecraft.displayGuiScreen(null); + NotificationScreen.this.minecraft.displayGuiScreen(null); query.finish(); })); } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java b/src/main/java/net/minecraftforge/fml/client/gui/widget/ExtendedButton.java similarity index 91% rename from src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java rename to src/main/java/net/minecraftforge/fml/client/gui/widget/ExtendedButton.java index f4eff64a5..07edcfde2 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiButtonExt.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/widget/ExtendedButton.java @@ -17,11 +17,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.fml.client.config; +package net.minecraftforge.fml.client.gui.widget; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.widget.Widget; import net.minecraft.client.gui.widget.button.Button; +import net.minecraftforge.fml.client.gui.GuiUtils; /** * This class provides a button that fixes several bugs present in the vanilla GuiButton drawing code. @@ -33,9 +34,9 @@ import net.minecraft.client.gui.widget.button.Button; * * @author bspkrs */ -public class GuiButtonExt extends Button +public class ExtendedButton extends Button { - public GuiButtonExt(int xPos, int yPos, int width, int height, String displayString, IPressable handler) + public ExtendedButton(int xPos, int yPos, int width, int height, String displayString, IPressable handler) { super(xPos, yPos, width, height, displayString, handler); } diff --git a/src/main/java/net/minecraftforge/fml/client/gui/ModListWidget.java b/src/main/java/net/minecraftforge/fml/client/gui/widget/ModListWidget.java similarity index 95% rename from src/main/java/net/minecraftforge/fml/client/gui/ModListWidget.java rename to src/main/java/net/minecraftforge/fml/client/gui/widget/ModListWidget.java index 1227664b9..b4150747b 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/ModListWidget.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/widget/ModListWidget.java @@ -17,13 +17,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.fml.client.gui; +package net.minecraftforge.fml.client.gui.widget; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.widget.list.ExtendedList; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.client.gui.screen.ModListScreen; import net.minecraftforge.versions.forge.ForgeVersion; import net.minecraftforge.fml.MavenVersionStringHelper; import net.minecraftforge.fml.VersionChecker; @@ -59,7 +60,7 @@ public class ModListWidget extends ExtendedList return this.listWidth; } - void refreshList() { + public void refreshList() { this.clearEntries(); parent.buildModList(this::addEntry, mod->new ModEntry(mod, this.parent)); } @@ -70,7 +71,7 @@ public class ModListWidget extends ExtendedList this.parent.renderBackground(); } - class ModEntry extends ExtendedList.AbstractListEntry { + public class ModEntry extends ExtendedList.AbstractListEntry { private final ModInfo modInfo; private final ModListScreen parent; diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java b/src/main/java/net/minecraftforge/fml/client/gui/widget/Slider.java similarity index 88% rename from src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java rename to src/main/java/net/minecraftforge/fml/client/gui/widget/Slider.java index 5d7d87cd1..a8d66e77a 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/widget/Slider.java @@ -17,9 +17,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.fml.client.config; +package net.minecraftforge.fml.client.gui.widget; import net.minecraft.client.Minecraft; +import net.minecraftforge.fml.client.gui.GuiUtils; import javax.annotation.Nullable; @@ -28,7 +29,7 @@ import javax.annotation.Nullable; * * @author iChun */ -public class GuiSlider extends GuiButtonExt +public class Slider extends ExtendedButton { /** The value of this slider control. */ public double sliderValue = 1.0F; @@ -50,12 +51,12 @@ public class GuiSlider extends GuiButtonExt public boolean drawString = true; - public GuiSlider(int xPos, int yPos, int width, int height, String prefix, String suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, IPressable handler) + public Slider(int xPos, int yPos, int width, int height, String prefix, String suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, IPressable handler) { this(xPos, yPos, width, height, prefix, suf, minVal, maxVal, currentVal, showDec, drawStr, handler, null); } - public GuiSlider(int xPos, int yPos, int width, int height, String prefix, String suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, IPressable handler, @Nullable ISlider par) + public Slider(int xPos, int yPos, int width, int height, String prefix, String suf, double minVal, double maxVal, double currentVal, boolean showDec, boolean drawStr, IPressable handler, @Nullable ISlider par) { super(xPos, yPos, width, height, prefix, handler); minValue = minVal; @@ -85,7 +86,7 @@ public class GuiSlider extends GuiButtonExt setMessage(""); } - public GuiSlider(int xPos, int yPos, String displayStr, double minVal, double maxVal, double currentVal, IPressable handler, ISlider par) + public Slider(int xPos, int yPos, String displayStr, double minVal, double maxVal, double currentVal, IPressable handler, ISlider par) { this(xPos, yPos, 150, 20, displayStr, "", minVal, maxVal, currentVal, true, true, handler, par); } @@ -207,6 +208,6 @@ public class GuiSlider extends GuiButtonExt public static interface ISlider { - void onChangeSliderValue(GuiSlider slider); + void onChangeSliderValue(Slider slider); } } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java b/src/main/java/net/minecraftforge/fml/client/gui/widget/UnicodeGlyphButton.java similarity index 91% rename from src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java rename to src/main/java/net/minecraftforge/fml/client/gui/widget/UnicodeGlyphButton.java index cdf255238..046adad55 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/widget/UnicodeGlyphButton.java @@ -17,24 +17,25 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.fml.client.config; +package net.minecraftforge.fml.client.gui.widget; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.widget.button.Button; +import net.minecraftforge.fml.client.gui.GuiUtils; /** * This class provides a button that shows a string glyph at the beginning. The glyph can be scaled using the glyphScale parameter. * * @author bspkrs */ -public class GuiUnicodeGlyphButton extends GuiButtonExt +public class UnicodeGlyphButton extends ExtendedButton { public String glyph; public float glyphScale; - public GuiUnicodeGlyphButton(int xPos, int yPos, int width, int height, String displayString, String glyph, float glyphScale, IPressable handler) + public UnicodeGlyphButton(int xPos, int yPos, int width, int height, String displayString, String glyph, float glyphScale, IPressable handler) { super(xPos, yPos, width, height, displayString, handler); this.glyph = glyph; diff --git a/src/main/java/net/minecraftforge/fml/common/ClassNameUtils.java b/src/main/java/net/minecraftforge/fml/common/ClassNameUtils.java deleted file mode 100644 index eb44e6307..000000000 --- a/src/main/java/net/minecraftforge/fml/common/ClassNameUtils.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.common; - -public class ClassNameUtils -{ - public static String shortName(Class clz) - { - String nm = clz.getName(); - return nm.indexOf('.') > -1 ? nm.substring(nm.lastIndexOf('.')+1) : nm; - } -} diff --git a/src/main/java/net/minecraftforge/fml/common/IFMLHandledException.java b/src/main/java/net/minecraftforge/fml/common/IFMLHandledException.java deleted file mode 100644 index 711d51cc9..000000000 --- a/src/main/java/net/minecraftforge/fml/common/IFMLHandledException.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.common; - -public interface IFMLHandledException -{ - -} diff --git a/src/main/java/net/minecraftforge/fml/common/IWorldGenerator.java b/src/main/java/net/minecraftforge/fml/common/IWorldGenerator.java deleted file mode 100644 index fb2756398..000000000 --- a/src/main/java/net/minecraftforge/fml/common/IWorldGenerator.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.common; - -import java.util.Random; - -import net.minecraft.world.World; -import net.minecraft.world.chunk.AbstractChunkProvider; -import net.minecraft.world.gen.ChunkGenerator; - - -/** - * This is called back during world generation. - * - * @author cpw - * - */ -public interface IWorldGenerator -{ - /** - * Generate some world - * - * @param random the chunk specific {@link Random}. - * @param chunkX the chunk X coordinate of this chunk. - * @param chunkZ the chunk Z coordinate of this chunk. - * @param world : additionalData[0] The minecraft {@link World} we're generating for. - * @param chunkGenerator : additionalData[1] The {@link IChunkProvider} that is generating. - * @param chunkProvider : additionalData[2] {@link IChunkProvider} that is requesting the world generation. - * - */ - void generate(Random random, int chunkX, int chunkZ, World world, ChunkGenerator chunkGenerator, AbstractChunkProvider chunkProvider); -} diff --git a/src/main/java/net/minecraftforge/fml/common/network/IGuiHandler.java b/src/main/java/net/minecraftforge/fml/common/network/IGuiHandler.java deleted file mode 100644 index 6eba278f5..000000000 --- a/src/main/java/net/minecraftforge/fml/common/network/IGuiHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.common.network; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.world.World; - -import javax.annotation.Nullable; - -public interface IGuiHandler -{ - /** - * Returns a Server side Container to be displayed to the user. - * - * @param ID The Gui ID Number - * @param player The player viewing the Gui - * @param world The current world - * @param x X Position - * @param y Y Position - * @param z Z Position - * @return A GuiScreen/Container to be displayed to the user, null if none. - */ - @Nullable - Object getServerGuiElement(int ID, PlayerEntity player, World world, int x, int y, int z); - - /** - * Returns a Container to be displayed to the user. On the client side, this - * needs to return a instance of GuiScreen On the server side, this needs to - * return a instance of Container - * - * @param ID The Gui ID Number - * @param player The player viewing the Gui - * @param world The current world - * @param x X Position - * @param y Y Position - * @param z Z Position - * @return A GuiScreen/Container to be displayed to the user, null if none. - */ - @Nullable - Object getClientGuiElement(int ID, PlayerEntity player, World world, int x, int y, int z); -} diff --git a/src/main/java/net/minecraftforge/fml/common/registry/ExistingSubstitutionException.java b/src/main/java/net/minecraftforge/fml/common/registry/ExistingSubstitutionException.java deleted file mode 100644 index 706431c78..000000000 --- a/src/main/java/net/minecraftforge/fml/common/registry/ExistingSubstitutionException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2019. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml.common.registry; - -import net.minecraft.util.ResourceLocation; - -public class ExistingSubstitutionException extends Exception { - public ExistingSubstitutionException(ResourceLocation fromName, Object toReplace) { - } - - private static final long serialVersionUID = 1L; - -} diff --git a/src/main/java/net/minecraftforge/fml/config/ConfigFileTypeHandler.java b/src/main/java/net/minecraftforge/fml/config/ConfigFileTypeHandler.java index 0d8427e79..4abf0577f 100644 --- a/src/main/java/net/minecraftforge/fml/config/ConfigFileTypeHandler.java +++ b/src/main/java/net/minecraftforge/fml/config/ConfigFileTypeHandler.java @@ -92,7 +92,7 @@ public class ConfigFileTypeHandler { if (!this.modConfig.getSpec().isCorrecting()) { this.commentedFileConfig.load(); LOGGER.debug(CONFIG, "Config file {} changed, sending notifies", this.modConfig.getFileName()); - this.modConfig.fireEvent(new ModConfig.ConfigReloading(this.modConfig)); + this.modConfig.fireEvent(new ModConfig.Reloading(this.modConfig)); } } } diff --git a/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java b/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java index baf38270e..5a1836fc7 100644 --- a/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java +++ b/src/main/java/net/minecraftforge/fml/config/ConfigTracker.java @@ -106,7 +106,7 @@ public class ConfigTracker { if (!Minecraft.getInstance().isIntegratedServerRunning()) { Optional.ofNullable(fileMap.get(s2CConfigData.getFileName())).ifPresent(mc-> { mc.setConfigData(TomlFormat.instance().createParser().parse(new ByteArrayInputStream(s2CConfigData.getBytes()))); - mc.fireEvent(new ModConfig.ConfigReloading(mc)); + mc.fireEvent(new ModConfig.Reloading(mc)); }); } } diff --git a/src/main/java/net/minecraftforge/fml/config/ModConfig.java b/src/main/java/net/minecraftforge/fml/config/ModConfig.java index f538c3bb7..200777b22 100644 --- a/src/main/java/net/minecraftforge/fml/config/ModConfig.java +++ b/src/main/java/net/minecraftforge/fml/config/ModConfig.java @@ -151,8 +151,8 @@ public class ModConfig } } - public static class ConfigReloading extends ModConfigEvent { - ConfigReloading(final ModConfig config) { + public static class Reloading extends ModConfigEvent { + Reloading(final ModConfig config) { super(config); } } diff --git a/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java b/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java index b1720c6a2..3935e893d 100644 --- a/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java +++ b/src/main/java/net/minecraftforge/fml/packs/ModFileResourcePack.java @@ -19,38 +19,24 @@ package net.minecraftforge.fml.packs; -import net.minecraft.resources.ResourcePack; import net.minecraft.resources.ResourcePackInfo; import net.minecraft.resources.ResourcePackType; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.StackTraceUtils; import net.minecraftforge.fml.loading.moddiscovery.ModFile; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.nio.channels.FileChannel; -import java.nio.channels.SeekableByteChannel; -import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; import java.util.Collection; import java.util.Collections; import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; import java.util.function.Predicate; import java.util.stream.Collectors; import com.google.common.base.Joiner; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import static net.minecraftforge.fml.Logging.CORE; public class ModFileResourcePack extends DelegatableResourcePack {