diff --git a/build.gradle b/build.gradle index 62ed8a3..2fd9d17 100644 --- a/build.gradle +++ b/build.gradle @@ -24,6 +24,10 @@ dependencies { modApi("me.shedaniel.cloth:config-2:${project.cloth_config_version}") { exclude(group: "net.fabricmc.fabric-api") } + + include("me.shedaniel.cloth:config-2:${project.cloth_config_version}") { + exclude(group: "net.fabricmc.fabric-api") + } } processResources { diff --git a/gradle.properties b/gradle.properties index 60f0c61..3ca056d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,24 +2,15 @@ org.gradle.jvmargs = -Xmx1G #Fabric properties minecraft_version = 1.16.3 -yarn_mappings = 1.16.3+build.11 -loader_version = 0.9.3+build.207 +yarn_mappings = 1.16.3+build.47 +loader_version = 0.10.5+build.213 #Mod properties -mod_version = 1.16.3-0.0.4 +mod_version = 1.16.3-0.0.5 maven_group = minimalmenu archives_base_name = minimalmenu #Dependencies -fabric_api_version = 0.21.0+build.407-1.16 +fabric_api_version = 0.24.3+build.414-1.16 mod_menu_version = 1.14.6+build.31 -cloth_config_version = 4.7.0-unstable - -modmenu_1.16.2 = 1.14.6+build.31 -cloth_config_1.16.2 = 4.8.1 - -modmenu_1.16.1 = 1.14.5+build.30 -cloth_config_1.16.1 = 4.6.0 - -modmenu_1.16.3 = 1.14.6+build.31 -cloth_config_1.16.3 = 4.8.1 \ No newline at end of file +cloth_config_version = 4.8.2 \ No newline at end of file diff --git a/src/main/java/minimalmenu/mixin/TitleScreenMixin.java b/src/main/java/minimalmenu/mixin/TitleScreenMixin.java index 2fc72ac..b9f3b62 100644 --- a/src/main/java/minimalmenu/mixin/TitleScreenMixin.java +++ b/src/main/java/minimalmenu/mixin/TitleScreenMixin.java @@ -1,5 +1,6 @@ package minimalmenu.mixin; +import com.google.common.collect.Lists; import minimalmenu.MinimalMenu; import minimalmenu.config.ConfigHandler; import net.minecraft.client.gui.CubeMapRenderer; @@ -8,6 +9,7 @@ import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.widget.AbstractButtonWidget; import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -15,6 +17,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.List; + @Mixin(TitleScreen.class) public class TitleScreenMixin extends Screen { @Shadow public static final CubeMapRenderer PANORAMA_CUBE_MAP = new CubeMapRenderer(new Identifier("textures/gui/title/background/panorama")); @@ -50,36 +54,44 @@ protected void init(CallbackInfo info) { copyrightTextX = 1000000000; } - for (AbstractButtonWidget buttonWidget : this.buttons) { + List buttonsTypes = Lists.newArrayList(); + for (AbstractButtonWidget button : this.buttons) { + buttonsTypes.add(((TranslatableText) button.getMessage()).getKey()); + } + + for (int i = 0; i < this.buttons.size(); i++) { + AbstractButtonWidget buttonWidget = this.buttons.get(i); + String buttonType = buttonsTypes.get(i); + if (ConfigHandler.REMOVE_SINGLEPLAYER) { - if (buttons.indexOf(buttonWidget) == 0) { + if (buttonType.equals("menu.singleplayer")) { buttonWidget.visible = false; - } else if (buttons.indexOf(buttonWidget) == 1 || buttons.indexOf(buttonWidget) == 2 || buttons.indexOf(buttonWidget) == 3 || buttons.indexOf(buttonWidget) == 4 || buttons.indexOf(buttonWidget) == 5 || buttons.indexOf(buttonWidget) == 6 || buttons.indexOf(buttonWidget) == 7) { + } else if (i > buttonsTypes.indexOf("menu.singleplayer")) { buttonWidget.y -= 24; } } if (ConfigHandler.REMOVE_MULTIPLAYER) { - if (buttons.indexOf(buttonWidget) == 1) { + if (buttonType.equals("menu.multiplayer")) { buttonWidget.visible = false; - } else if (buttons.indexOf(buttonWidget) == 2 || buttons.indexOf(buttonWidget) == 3 || buttons.indexOf(buttonWidget) == 4 || buttons.indexOf(buttonWidget) == 5 || buttons.indexOf(buttonWidget) == 6 || buttons.indexOf(buttonWidget) == 7) { + } else if (i > buttonsTypes.indexOf("menu.multiplayer")) { buttonWidget.y -= 24; } } if (ConfigHandler.REMOVE_REALMS) { - if (buttons.indexOf(buttonWidget) == 2) { + if (buttonType.equals("menu.online")) { buttonWidget.visible = false; - } else if (buttons.indexOf(buttonWidget) == 3 || buttons.indexOf(buttonWidget) == 4 || buttons.indexOf(buttonWidget) == 5 || buttons.indexOf(buttonWidget) == 6 || buttons.indexOf(buttonWidget) == 7) { + } else if (i > buttonsTypes.indexOf("menu.online")) { buttonWidget.y -= 24; } } - if (ConfigHandler.REMOVE_LANGUAGE && buttons.indexOf(buttonWidget) == 4) { + if (ConfigHandler.REMOVE_LANGUAGE && buttonType.equals("narrator.button.language")) { buttonWidget.visible = false; } - if (ConfigHandler.REMOVE_ACCESSIBILITY && buttons.indexOf(buttonWidget) == 7) { + if (ConfigHandler.REMOVE_ACCESSIBILITY && buttonType.equals("narrator.button.accessibility")) { buttonWidget.visible = false; }