diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-01-08 18:23:00 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-01-08 18:23:00 +0800 |
| commit | 72e1653cbb38282f8dce59a00fb381e18bfc795d (patch) | |
| tree | 468a1d03c3a7295b43f28e71b84856a512e72b3f /src/main/java/me/shedaniel/mixins/MixinContainerGui.java | |
| parent | 6d5101aad169bc5d4d8bcd638aee0d4ce71c120a (diff) | |
| download | RoughlyEnoughItems-72e1653cbb38282f8dce59a00fb381e18bfc795d.tar.gz RoughlyEnoughItems-72e1653cbb38282f8dce59a00fb381e18bfc795d.tar.bz2 RoughlyEnoughItems-72e1653cbb38282f8dce59a00fb381e18bfc795d.zip | |
Craftable Only WIP
Diffstat (limited to 'src/main/java/me/shedaniel/mixins/MixinContainerGui.java')
| -rwxr-xr-x | src/main/java/me/shedaniel/mixins/MixinContainerGui.java | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/main/java/me/shedaniel/mixins/MixinContainerGui.java b/src/main/java/me/shedaniel/mixins/MixinContainerGui.java index b9bf0545b..50053998f 100755 --- a/src/main/java/me/shedaniel/mixins/MixinContainerGui.java +++ b/src/main/java/me/shedaniel/mixins/MixinContainerGui.java @@ -19,6 +19,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; */ @Mixin(ContainerGui.class) public abstract class MixinContainerGui extends Gui implements IMixinContainerGui { + @Shadow protected Slot focusedSlot; @Shadow @@ -40,32 +41,24 @@ public abstract class MixinContainerGui extends Gui implements IMixinContainerGu @Inject(method = "mouseClicked(DDI)Z", at = @At("HEAD"), cancellable = true) private void mouseClick(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_, CallbackInfoReturnable<Boolean> ci) { - boolean handled = false; - for(GuiCickListener listener : Core.getListeners(GuiCickListener.class)) { + for(GuiClick listener : Core.getListeners(GuiClick.class)) if (listener.onClick((int) p_mouseClicked_1_, (int) p_mouseClicked_3_, p_mouseClicked_5_)) { ci.setReturnValue(true); - handled = true; + ci.cancel(); } - } - if (handled) - ci.cancel(); } @Inject(method = "keyPressed(III)Z", at = @At("HEAD"), cancellable = true) private void onKeyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_, CallbackInfoReturnable<Boolean> ci) { - boolean handled = false; - for(GuiKeyDown listener : Core.getListeners(GuiKeyDown.class)) { - if (listener.keyDown(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_)) - handled = true; - } - if (handled) { - ci.setReturnValue(handled); - ci.cancel(); - } + for(GuiKeyDown listener : Core.getListeners(GuiKeyDown.class)) + if (listener.keyDown(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_)) { + ci.setReturnValue(true); + ci.cancel(); + } } public boolean mouseScrolled(double p_mouseScrolled_1_) { - for(MouseScrollListener listener : Core.getListeners(MouseScrollListener.class)) + for(GuiMouseScroll listener : Core.getListeners(GuiMouseScroll.class)) if (listener.mouseScrolled(p_mouseScrolled_1_)) return true; return super.mouseScrolled(p_mouseScrolled_1_); @@ -100,4 +93,5 @@ public abstract class MixinContainerGui extends Gui implements IMixinContainerGu public int getContainerWidth() { return containerWidth; } + } |
