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.

This commit is contained in:
LexManos 2012-03-17 01:08:53 -07:00
parent c0bf315876
commit 230a4188f8
2 changed files with 30 additions and 8 deletions

View File

@ -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)

View File

@ -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)