diff --git a/src/main/java/noppes/npcs/containers/ContainerAnvilRepair.java b/src/main/java/noppes/npcs/containers/ContainerAnvilRepair.java index 1d1c3052f..eb7278323 100644 --- a/src/main/java/noppes/npcs/containers/ContainerAnvilRepair.java +++ b/src/main/java/noppes/npcs/containers/ContainerAnvilRepair.java @@ -273,19 +273,21 @@ public class ContainerAnvilRepair extends Container { public boolean preEvent(EntityPlayer player) { preChecked = true; - RecipeAnvil recipe = container.currentRecipe; - if (recipe != null) { - ItemStack[] items = new ItemStack[]{ - container.anvilMatrix.getStackInRowAndColumn(0, 0), - container.anvilMatrix.getStackInRowAndColumn(1, 0) - }; - canPickup = !EventHooks.onRecipeScriptPre(player, recipe.getScriptHandler(), recipe, items); - if (!canPickup) { - container.updateRepairResult(); - preChecked = false; // reset for next attempt + if (!container.worldObj.isRemote) { + RecipeAnvil recipe = container.currentRecipe; + if (recipe != null) { + ItemStack[] items = new ItemStack[]{ + container.anvilMatrix.getStackInRowAndColumn(0, 0), + container.anvilMatrix.getStackInRowAndColumn(1, 0) + }; + canPickup = !EventHooks.onRecipeScriptPre(player, recipe.getScriptHandler(), recipe, items); + if (!canPickup) { + container.updateRepairResult(); + preChecked = false; // reset for next attempt + } + } else { + canPickup = true; } - } else { - canPickup = true; } return canPickup; } @@ -317,7 +319,7 @@ public class ContainerAnvilRepair extends Container { container.anvilMatrix.getStackInRowAndColumn(0, 0), container.anvilMatrix.getStackInRowAndColumn(1, 0) }; - if (recipe != null) { + if (!container.worldObj.isRemote && recipe != null) { container.updateRepairResult(); stack = EventHooks.onRecipeScriptPost(player, recipe.getScriptHandler(), recipe, items, stack); } diff --git a/src/main/java/noppes/npcs/containers/ContainerCarpentryBench.java b/src/main/java/noppes/npcs/containers/ContainerCarpentryBench.java index 05d5cf402..8183b467b 100644 --- a/src/main/java/noppes/npcs/containers/ContainerCarpentryBench.java +++ b/src/main/java/noppes/npcs/containers/ContainerCarpentryBench.java @@ -174,19 +174,21 @@ public class ContainerCarpentryBench extends Container { public boolean preEvent(EntityPlayer player) { preChecked = true; - RecipeCarpentry recipe = container.currentRecipe; - if (recipe != null) { - ItemStack[] items = new ItemStack[matrix.getSizeInventory()]; - for (int i = 0; i < items.length; i++) { - items[i] = matrix.getStackInSlot(i); + if (!container.worldObj.isRemote) { + RecipeCarpentry recipe = container.currentRecipe; + if (recipe != null) { + ItemStack[] items = new ItemStack[matrix.getSizeInventory()]; + for (int i = 0; i < items.length; i++) { + items[i] = matrix.getStackInSlot(i); + } + canPickup = !EventHooks.onRecipeScriptPre(player, recipe.getScriptHandler(), recipe, items); + if (!canPickup) { + container.onCraftMatrixChanged(matrix); + preChecked = false; // reset for next attempt + } + } else { + canPickup = true; } - canPickup = !EventHooks.onRecipeScriptPre(player, recipe.getScriptHandler(), recipe, items); - if (!canPickup) { - container.onCraftMatrixChanged(matrix); - preChecked = false; // reset for next attempt - } - } else { - canPickup = true; } return canPickup; } @@ -207,13 +209,15 @@ public class ContainerCarpentryBench extends Container { } if (!canPickup) return; - RecipeCarpentry recipe = container.currentRecipe; - if (recipe != null) { - ItemStack[] items = new ItemStack[matrix.getSizeInventory()]; - for (int i = 0; i < items.length; i++) { - items[i] = matrix.getStackInSlot(i); + if (!container.worldObj.isRemote) { + RecipeCarpentry recipe = container.currentRecipe; + if (recipe != null) { + ItemStack[] items = new ItemStack[matrix.getSizeInventory()]; + for (int i = 0; i < items.length; i++) { + items[i] = matrix.getStackInSlot(i); + } + stack = EventHooks.onRecipeScriptPost(player, recipe.getScriptHandler(), recipe, items, stack); } - stack = EventHooks.onRecipeScriptPost(player, recipe.getScriptHandler(), recipe, items, stack); } preChecked = false; canPickup = true;