summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
author alemi <me@alemi.dev>2023-02-16 02:40:15 +0100
committer alemi <me@alemi.dev>2023-02-16 02:40:15 +0100
commitf85188f31038d2c58c04628d557ef361ba9982da (patch)
treeb33b4f5e363222f6609716c4b00a18c8ec449d92 /src/main/java
parentb5d76e3494940d7f0c88a61a31c6a038e72db6b6 (diff)
feat: bring back mods button!
kinda broken and jank but hey it works for now;
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/ftbsc/bscv/BoSCoVicino.java28
1 files changed, 28 insertions, 0 deletions
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;
@@ -138,6 +142,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
ClientPlayerEntity player = MC.player;