From 2544a773f78b1cb8d7b63678997fcb23d3b421fe Mon Sep 17 00:00:00 2001 From: Rhys <98863820+rhysdh540@users.noreply.github.com> Date: Fri, 31 May 2024 07:47:57 -0400 Subject: [PATCH] obfuscate old forge config guis - saves ~500 bytes just need the providers also not tested --- .../zume/archaic/ArchaicConfigProvider.java | 15 ----------- .../zume/archaic/ArchaicZumeConfigGUI.java | 25 ++++++++++++++++++ proguard.pro | 2 +- .../zume/vintage/VintageConfigProvider.java | 21 --------------- .../zume/vintage/VintageZumeConfigGUI.java | 26 +++++++++++++++++++ 5 files changed, 52 insertions(+), 37 deletions(-) create mode 100644 archaic/src/main/java/dev/nolij/zume/archaic/ArchaicZumeConfigGUI.java create mode 100644 vintage/src/main/java/dev/nolij/zume/vintage/VintageZumeConfigGUI.java diff --git a/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicConfigProvider.java b/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicConfigProvider.java index d7ada8ae..4ac649cc 100644 --- a/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicConfigProvider.java +++ b/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicConfigProvider.java @@ -14,21 +14,6 @@ @SuppressWarnings("unused") public class ArchaicConfigProvider implements IModGuiFactory { - public static class ArchaicZumeConfigGUI extends GuiConfig { - - public ArchaicZumeConfigGUI(GuiScreen parentScreen) { - super(parentScreen, Collections.emptyList(), MOD_ID, false, false, "config"); - - ZumeAPI.openConfigFile(); - } - - @Override - public void initGui() { - Minecraft.getMinecraft().displayGuiScreen(parentScreen); - } - - } - @Override public Class mainConfigGuiClass() { return ArchaicZumeConfigGUI.class; diff --git a/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicZumeConfigGUI.java b/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicZumeConfigGUI.java new file mode 100644 index 00000000..73728f80 --- /dev/null +++ b/archaic/src/main/java/dev/nolij/zume/archaic/ArchaicZumeConfigGUI.java @@ -0,0 +1,25 @@ +package dev.nolij.zume.archaic; + +import cpw.mods.fml.client.config.GuiConfig; +import dev.nolij.zume.api.platform.v1.ZumeAPI; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; + +import java.util.Collections; + +import static dev.nolij.zume.impl.ZumeConstants.MOD_ID; + +public class ArchaicZumeConfigGUI extends GuiConfig { + + public ArchaicZumeConfigGUI(GuiScreen parentScreen) { + super(parentScreen, Collections.emptyList(), MOD_ID, false, false, "config"); + + ZumeAPI.openConfigFile(); + } + + @Override + public void initGui() { + Minecraft.getMinecraft().displayGuiScreen(parentScreen); + } + +} diff --git a/proguard.pro b/proguard.pro index 230f6c9e..3968d8e5 100644 --- a/proguard.pro +++ b/proguard.pro @@ -37,7 +37,7 @@ # Legacy Forge config providers -keep,allowoptimization class dev.nolij.zume.** implements *.*.fml.client.IModGuiFactory --keep,allowoptimization class dev.nolij.zume.** extends *.*.fml.client.config.GuiConfig { *; } +-keep,allowoptimization,allowobfuscation class dev.nolij.zume.** extends *.*.fml.client.config.GuiConfig { *; } -keep,allowoptimization class io.github.prospector.modmenu.** { *; } # ugly classloader hack diff --git a/vintage/src/main/java/dev/nolij/zume/vintage/VintageConfigProvider.java b/vintage/src/main/java/dev/nolij/zume/vintage/VintageConfigProvider.java index f659ed79..1aefb2d8 100644 --- a/vintage/src/main/java/dev/nolij/zume/vintage/VintageConfigProvider.java +++ b/vintage/src/main/java/dev/nolij/zume/vintage/VintageConfigProvider.java @@ -1,35 +1,14 @@ package dev.nolij.zume.vintage; -import dev.nolij.zume.api.platform.v1.ZumeAPI; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.fml.client.IModGuiFactory; -import net.minecraftforge.fml.client.config.GuiConfig; -import java.util.Collections; import java.util.Set; -import static dev.nolij.zume.impl.ZumeConstants.MOD_ID; - @SuppressWarnings("unused") public class VintageConfigProvider implements IModGuiFactory { - public static class VintageZumeConfigGUI extends GuiConfig { - - public VintageZumeConfigGUI(GuiScreen parentScreen) { - super(parentScreen, Collections.emptyList(), MOD_ID, false, false, "config"); - - ZumeAPI.openConfigFile(); - } - - @Override - public void initGui() { - this.onGuiClosed(); - Minecraft.getMinecraft().displayGuiScreen(parentScreen); - } - - } - @Override public GuiScreen createConfigGui(GuiScreen parentScreen) { return new VintageZumeConfigGUI(parentScreen); diff --git a/vintage/src/main/java/dev/nolij/zume/vintage/VintageZumeConfigGUI.java b/vintage/src/main/java/dev/nolij/zume/vintage/VintageZumeConfigGUI.java new file mode 100644 index 00000000..d0cf8ce8 --- /dev/null +++ b/vintage/src/main/java/dev/nolij/zume/vintage/VintageZumeConfigGUI.java @@ -0,0 +1,26 @@ +package dev.nolij.zume.vintage; + +import dev.nolij.zume.api.platform.v1.ZumeAPI; +import net.minecraftforge.fml.client.config.GuiConfig; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; + +import java.util.Collections; + +import static dev.nolij.zume.impl.ZumeConstants.MOD_ID; + +public class VintageZumeConfigGUI extends GuiConfig { + + public VintageZumeConfigGUI(GuiScreen parentScreen) { + super(parentScreen, Collections.emptyList(), MOD_ID, false, false, "config"); + + ZumeAPI.openConfigFile(); + } + + @Override + public void initGui() { + this.onGuiClosed(); + Minecraft.getMinecraft().displayGuiScreen(parentScreen); + } + +}