diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fb052427..bf3ebe3d5 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ NOTE: Worlds that used Refined Storage 1.5.x are fully compatible with Refined S - Fixed crash when moving a wireless item with the number keys (raoulvdberge) - Fixed bug where item storage tracker didn't save sometimes (raoulvdberge) - Fixed bug where External Storage doesn't detect new inventory when rotating (raoulvdberge) +- Fixed JEI recipe transferring in Pattern Grid allowing non-processing recipes in processing mode and vice-versa (raoulvdberge) - Prevent accidental Grid scrollbar click after clicking JEI recipe transfer button (raoulvdberge) - Added a missing config option for Crafter Manager energy usage (raoulvdberge) - Added support for Disk Drive / Storage Block storage and capacity to OC integration (zangai) diff --git a/src/main/java/com/raoulvdberge/refinedstorage/integration/jei/RecipeTransferHandlerGrid.java b/src/main/java/com/raoulvdberge/refinedstorage/integration/jei/RecipeTransferHandlerGrid.java index 1a6c4b154..64adcb95a 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/integration/jei/RecipeTransferHandlerGrid.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/integration/jei/RecipeTransferHandlerGrid.java @@ -9,8 +9,10 @@ import com.raoulvdberge.refinedstorage.network.MessageGridProcessingTransfer; import com.raoulvdberge.refinedstorage.network.MessageGridTransfer; import mezz.jei.api.gui.IGuiIngredient; import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.recipe.VanillaRecipeCategoryUid; import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; +import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryCrafting; @@ -24,6 +26,18 @@ public class RecipeTransferHandlerGrid implements IRecipeTransferHandler { public static final long TRANSFER_SCROLL_DELAY_MS = 200; public static long LAST_TRANSFER; + private static final IRecipeTransferError ERROR_CANNOT_TRANSFER = new IRecipeTransferError() { + @Override + public Type getType() { + return Type.INTERNAL; + } + + @Override + public void showError(Minecraft minecraft, int mouseX, int mouseY, IRecipeLayout recipeLayout, int recipeX, int recipeY) { + // NO OP + } + }; + @Override public Class getContainerClass() { return ContainerGrid.class; @@ -31,11 +45,11 @@ public class RecipeTransferHandlerGrid implements IRecipeTransferHandler { @Override public IRecipeTransferError transferRecipe(Container container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + IGrid grid = ((ContainerGrid) container).getGrid(); + if (doTransfer) { LAST_TRANSFER = System.currentTimeMillis(); - IGrid grid = ((ContainerGrid) container).getGrid(); - if (grid.getType() == GridType.PATTERN && ((NetworkNodeGrid) grid).isProcessingPattern()) { List inputs = new LinkedList<>(); List outputs = new LinkedList<>(); @@ -56,6 +70,16 @@ public class RecipeTransferHandlerGrid implements IRecipeTransferHandler { } else { RS.INSTANCE.network.sendToServer(new MessageGridTransfer(recipeLayout.getItemStacks().getGuiIngredients(), container.inventorySlots.stream().filter(s -> s.inventory instanceof InventoryCrafting).collect(Collectors.toList()))); } + } else { + if (grid.getType() == GridType.PATTERN && ((NetworkNodeGrid) grid).isProcessingPattern()) { + if (recipeLayout.getRecipeCategory().getUid().equals(VanillaRecipeCategoryUid.CRAFTING)) { + return ERROR_CANNOT_TRANSFER; + } + } else { + if (!recipeLayout.getRecipeCategory().getUid().equals(VanillaRecipeCategoryUid.CRAFTING)) { + return ERROR_CANNOT_TRANSFER; + } + } } return null;