Skip to content

Commit

Permalink
More custom wrapper compat (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
miozune committed Sep 7, 2024
1 parent cccea59 commit 4758eb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.cleanroommc.modularui;

import com.cleanroommc.modularui.api.IMuiScreen;
import com.cleanroommc.modularui.drawable.Stencil;
import com.cleanroommc.modularui.screen.GuiContainerWrapper;

import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
Expand Down Expand Up @@ -65,6 +65,6 @@ public static void onGuiInput(GuiScreenEvent.KeyboardInputEvent.Pre event) {
}

private static boolean hasDraggable(GuiScreenEvent event) {
return event.getGui() instanceof GuiContainerWrapper screenWrapper && screenWrapper.getScreen().getContext().hasDraggable();
return event.getGui() instanceof IMuiScreen screenWrapper && screenWrapper.getScreen().getContext().hasDraggable();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.cleanroommc.modularui.core.mixin;

import com.cleanroommc.modularui.screen.GuiContainerWrapper;
import com.cleanroommc.modularui.api.IMuiScreen;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Slot;
Expand All @@ -24,7 +24,7 @@ public class GuiContainerMixin {
*/
@Inject(method = "getSlotAtPosition", at = @At("HEAD"), cancellable = true)
public void getSlot(int x, int y, CallbackInfoReturnable<Slot> cir) {
if (((Object) this).getClass() == GuiContainerWrapper.class) {
if (IMuiScreen.class.isAssignableFrom(this.getClass())) {
cir.setReturnValue(this.hoveredSlot);
}
}
Expand Down

0 comments on commit 4758eb3

Please sign in to comment.