aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/xmrvizzy/skyblocker/mixin/MinecraftClientMixin.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/mixin/MinecraftClientMixin.java')
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/mixin/MinecraftClientMixin.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/mixin/MinecraftClientMixin.java b/src/main/java/me/xmrvizzy/skyblocker/mixin/MinecraftClientMixin.java
index e5f1b829..21730e69 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/mixin/MinecraftClientMixin.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/mixin/MinecraftClientMixin.java
@@ -1,9 +1,12 @@
package me.xmrvizzy.skyblocker.mixin;
import me.xmrvizzy.skyblocker.SkyblockerMod;
+import me.xmrvizzy.skyblocker.container.ContainerSolverManager;
import me.xmrvizzy.skyblocker.skyblock.HotbarSlotLock;
import me.xmrvizzy.skyblocker.utils.Utils;
import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.client.gui.screen.ingame.GenericContainerScreen;
import net.minecraft.client.network.ClientPlayerEntity;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
@@ -26,4 +29,13 @@ public class MinecraftClientMixin {
public void handleInputEvents(CallbackInfo ci) {
if (Utils.isSkyblock) HotbarSlotLock.handleInputEvents(player);
}
+
+ @Inject(method = "setScreen", at = @At("HEAD"))
+ public void onSetScreen(Screen screen, CallbackInfo ci) {
+ ContainerSolverManager manager = SkyblockerMod.getInstance().containerSolverManager;
+ if(Utils.isSkyblock && screen instanceof GenericContainerScreen)
+ manager.onSetScreen((GenericContainerScreen) screen);
+ else
+ manager.clearScreen();
+ }
} \ No newline at end of file