aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-01-08 18:23:00 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-01-08 18:23:00 +0800
commit72e1653cbb38282f8dce59a00fb381e18bfc795d (patch)
tree468a1d03c3a7295b43f28e71b84856a512e72b3f /src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java
parent6d5101aad169bc5d4d8bcd638aee0d4ce71c120a (diff)
downloadRoughlyEnoughItems-72e1653cbb38282f8dce59a00fb381e18bfc795d.tar.gz
RoughlyEnoughItems-72e1653cbb38282f8dce59a00fb381e18bfc795d.tar.bz2
RoughlyEnoughItems-72e1653cbb38282f8dce59a00fb381e18bfc795d.zip
Craftable Only WIP
Diffstat (limited to 'src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java')
-rw-r--r--src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java b/src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java
index 1385e374f..737f3c280 100644
--- a/src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java
+++ b/src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java
@@ -1,6 +1,8 @@
package me.shedaniel.mixins;
import me.shedaniel.Core;
+import me.shedaniel.gui.REIRenderHelper;
+import me.shedaniel.listenerdefinitions.GuiClick;
import me.shedaniel.listenerdefinitions.GuiKeyDown;
import net.minecraft.client.gui.ingame.AbstractPlayerInventoryGui;
import net.minecraft.client.gui.ingame.CreativePlayerInventoryGui;
@@ -27,15 +29,13 @@ public abstract class MixinCreativePlayerInventoryGui extends AbstractPlayerInve
@Inject(method = "keyPressed(III)Z", at = @At("HEAD"), cancellable = true)
public void keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_, CallbackInfoReturnable<Boolean> ci) {
- boolean handled = false;
if (method_2469() == ItemGroup.INVENTORY.getId())
for(GuiKeyDown listener : Core.getListeners(GuiKeyDown.class))
if (listener.keyDown(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_)) {
ci.setReturnValue(true);
- handled = true;
+ ci.cancel();
+ return;
}
- if (handled)
- ci.cancel();
}
@Inject(method = "mouseScrolled(D)Z", at = @At("HEAD"), cancellable = true)
@@ -46,4 +46,14 @@ public abstract class MixinCreativePlayerInventoryGui extends AbstractPlayerInve
}
}
+ @Inject(method = "mouseClicked(DDI)Z", at = @At("HEAD"), cancellable = true)
+ public void mouseClicked(double double_1, double double_2, int int_1, CallbackInfoReturnable<Boolean> ci) {
+ if (method_2469() == ItemGroup.INVENTORY.getId() && REIRenderHelper.isGuiVisible())
+ for(GuiClick guiClick : Core.getListeners(GuiClick.class))
+ if (guiClick.onClick((int) double_1, (int) double_2, int_1)) {
+ ci.setReturnValue(true);
+ ci.cancel();
+ }
+ }
+
}