浏览代码

Fixes stuff

Unknown 6 年之前
父节点
当前提交
8b89fff542

+ 1 - 1
build.gradle

@@ -6,7 +6,7 @@ sourceCompatibility = 1.8
 targetCompatibility = 1.8
 
 archivesBaseName = "RoughlyEnoughItems"
-version = "1.5.1-20"
+version = "1.5.1-21"
 
 minecraft {
 }

+ 1 - 0
src/main/java/me/shedaniel/impl/REIRecipeManager.java

@@ -192,6 +192,7 @@ public class REIRecipeManager implements IRecipeManager {
         REIRecipeManager.instance().recipeManager = manager;
         Core.getListeners(IREIPlugin.class).forEach(IREIPlugin::registerCategories);
         Core.getListeners(IREIPlugin.class).forEach(IREIPlugin::registerRecipes);
+        Core.getListeners(IREIPlugin.class).forEach(IREIPlugin::registerSpecialGuiExclusion);
     }
     
     public void displayRecipesFor(ItemStack stack) {

+ 14 - 9
src/main/java/me/shedaniel/mixins/MixinCreativePlayerInventoryGui.java

@@ -12,47 +12,52 @@ import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
 
 @Mixin(CreativePlayerInventoryGui.class)
 public abstract class MixinCreativePlayerInventoryGui extends AbstractPlayerInventoryGui {
     
     @Shadow
-    public abstract int method_2469();
+    protected abstract boolean doRenderScrollBar();
     
     @Shadow
-    protected abstract boolean doRenderScrollBar();
+    private static int selectedTab;
     
     public MixinCreativePlayerInventoryGui(Container container_1) {
         super(container_1);
     }
     
     @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) {
-        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_)) {
+    public void keyPressed(int a, int b, int c, CallbackInfoReturnable<Boolean> ci) {
+        if (selectedTab == ItemGroup.INVENTORY.getId())
+            Core.getListeners(GuiKeyDown.class).forEach(guiKeyDown -> {
+                if (guiKeyDown.keyDown(a, b, c)) {
                     ci.setReturnValue(true);
                     ci.cancel();
                     return;
                 }
+            });
     }
     
     @Inject(method = "mouseScrolled(D)Z", at = @At("HEAD"), cancellable = true)
     public void mouseScrolled(double p_mouseScrolled_1_, CallbackInfoReturnable<Boolean> ci) {
         if (!this.doRenderScrollBar()) {
-            ci.setReturnValue(super.mouseScrolled(p_mouseScrolled_1_));
-            ci.cancel();
+            if (super.mouseScrolled(p_mouseScrolled_1_)) {
+                ci.setReturnValue(true);
+                ci.cancel();
+            }
         }
     }
     
     @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())
+        if (selectedTab == 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();
+                    return;
                 }
     }