From 230a4188f80ddcc7f2316b006cb9a29a7d80cc1a Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 17 Mar 2012 01:08:53 -0700 Subject: [PATCH] Fixed onTakenFromCrafting hooks to be called once per stack taken. Sadly due to how shift-click is handled, the passed in item stack is not garenteed to be the stack that the result was added to. --- .../net/minecraft/src/SlotCrafting.java.patch | 19 +++++++++++++++---- .../net/minecraft/src/SlotCrafting.java.patch | 19 +++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/forge/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch b/forge/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch index 519c1562d..750d0bc07 100644 --- a/forge/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/SlotCrafting.java.patch @@ -8,11 +8,22 @@ public class SlotCrafting extends Slot { /** The craft matrix inventory linked to this result slot. */ -@@ -91,6 +93,7 @@ +@@ -89,8 +91,6 @@ + { + this.thePlayer.addStat(AchievementList.bookcase, 1); } - - ModLoader.takenFromCrafting(this.thePlayer, par1ItemStack, this.craftMatrix); -+ ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix); +- +- ModLoader.takenFromCrafting(this.thePlayer, par1ItemStack, this.craftMatrix); } /** +@@ -98,6 +98,9 @@ + */ + public void onPickupFromSlot(ItemStack par1ItemStack) + { ++ ModLoader.takenFromCrafting(this.thePlayer, par1ItemStack, this.craftMatrix); ++ ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix); ++ + this.func_48434_c(par1ItemStack); + + for (int var2 = 0; var2 < this.craftMatrix.getSizeInventory(); ++var2) diff --git a/forge/patches/minecraft_server/net/minecraft/src/SlotCrafting.java.patch b/forge/patches/minecraft_server/net/minecraft/src/SlotCrafting.java.patch index 17dcccd9d..773e1ebbb 100644 --- a/forge/patches/minecraft_server/net/minecraft/src/SlotCrafting.java.patch +++ b/forge/patches/minecraft_server/net/minecraft/src/SlotCrafting.java.patch @@ -8,11 +8,22 @@ public class SlotCrafting extends Slot { /** The craft matrix inventory linked to this result slot. */ -@@ -91,6 +93,7 @@ +@@ -89,8 +91,6 @@ + { + this.thePlayer.addStat(AchievementList.bookcase, 1); } - - ModLoader.takenFromCrafting(this.thePlayer, par1ItemStack, this.craftMatrix); -+ ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix); +- +- ModLoader.takenFromCrafting(this.thePlayer, par1ItemStack, this.craftMatrix); } /** +@@ -98,6 +98,9 @@ + */ + public void onPickupFromSlot(ItemStack par1ItemStack) + { ++ ModLoader.takenFromCrafting(this.thePlayer, par1ItemStack, this.craftMatrix); ++ ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix); ++ + this.func_48416_b(par1ItemStack); + + for (int var2 = 0; var2 < this.craftMatrix.getSizeInventory(); ++var2)