From f85188f31038d2c58c04628d557ef361ba9982da Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 16 Feb 2023 02:40:15 +0100 Subject: feat: bring back mods button! kinda broken and jank but hey it works for now; --- src/main/java/ftbsc/bscv/BoSCoVicino.java | 28 +++++++++++++++++++++++ src/main/resources/META-INF/accesstransformer.cfg | 6 +++-- 2 files changed, 32 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/ftbsc/bscv/BoSCoVicino.java b/src/main/java/ftbsc/bscv/BoSCoVicino.java index 2e5f6c5..8479ed8 100644 --- a/src/main/java/ftbsc/bscv/BoSCoVicino.java +++ b/src/main/java/ftbsc/bscv/BoSCoVicino.java @@ -2,10 +2,14 @@ package ftbsc.bscv; import net.minecraft.block.Block; import net.minecraft.client.entity.player.ClientPlayerEntity; +import net.minecraft.client.gui.screen.IngameMenuScreen; +import net.minecraft.client.gui.widget.button.Button; import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.client.event.ClientChatEvent; +import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; @@ -137,6 +141,30 @@ public class BoSCoVicino implements ICommons { } } + @SubscribeEvent + public void onPauseMenu(InitGuiEvent.Post event) { + if (event.getGui() instanceof IngameMenuScreen) { // TODO de-jank this, maybe by extending IngameMenuScreen + IngameMenuScreen screen = (IngameMenuScreen) event.getGui(); + screen.buttons.remove(3); + screen.buttons.remove(3); + screen.children.remove(3); + screen.children.remove(3); + Button mods_btn = new Button( + screen.width / 2 + 4, + screen.height / 4 + 72 + -16, 98, 20, + new TranslationTextComponent("fml.menu.mods"), + cb -> { + MC.setScreen(new net.minecraftforge.fml.client.gui.screen.ModListScreen(screen)); + } + ); + // need to add it twice for it to work once... + screen.buttons.add(3, mods_btn); + screen.buttons.add(3, mods_btn); + screen.children.add(3, mods_btn); + screen.children.add(3, mods_btn); + } + } + @SubscribeEvent public void onWorldLoad(WorldEvent.Load event) { // TEMPORARY! add command to regenerate suggestions diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index a536e51..0dd8cc6 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1,2 +1,4 @@ -public net.minecraft.client.network.play.NetworkPlayerInfo field_178866_b -public net.minecraft.network.play.client.CPlayerPacket field_149474_g +public net.minecraft.client.gui.screen.Screen field_230710_m_ # buttons +public net.minecraft.client.gui.screen.Screen field_230705_e_ # children +public net.minecraft.client.network.play.NetworkPlayerInfo field_178866_b # gameMode +public net.minecraft.network.play.client.CPlayerPacket field_149474_g # onGround -- cgit v1.2.3-56-ga3b1