diff --git a/src/main/java/forestry/core/gui/slots/SlotCrafter.java b/src/main/java/forestry/core/gui/slots/SlotCrafter.java index 91bc54acf..fdd507836 100755 --- a/src/main/java/forestry/core/gui/slots/SlotCrafter.java +++ b/src/main/java/forestry/core/gui/slots/SlotCrafter.java @@ -10,20 +10,22 @@ ******************************************************************************/ package forestry.core.gui.slots; +import cpw.mods.fml.common.FMLCommonHandler; +import forestry.core.interfaces.ICrafter; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; +import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; -import forestry.core.interfaces.ICrafter; - -public class SlotCrafter extends Slot { +public class SlotCrafter extends SlotCrafting { private final ICrafter crafter; + private final IInventory craftMatrix; - public SlotCrafter(IInventory inventory, ICrafter crafter, int slot, int xPos, int yPos) { - super(inventory, slot, xPos, yPos); + public SlotCrafter(EntityPlayer player, IInventory craftMatrix, ICrafter crafter, int slot, int xPos, int yPos) { + super(player, craftMatrix, craftMatrix, slot, xPos, yPos); this.crafter = crafter; + this.craftMatrix = craftMatrix; } @Override @@ -56,6 +58,8 @@ public class SlotCrafter extends Slot { @Override public void onPickupFromSlot(EntityPlayer player, ItemStack itemStack) { + FMLCommonHandler.instance().firePlayerCraftingEvent(player, itemStack, craftMatrix); + this.onCrafting(itemStack, itemStack.stackSize); // handles crafting achievements, maps, and statistics crafter.takenFromSlot(getSlotIndex(), true, player); } } diff --git a/src/main/java/forestry/factory/gui/ContainerFabricator.java b/src/main/java/forestry/factory/gui/ContainerFabricator.java index 6833d140e..1fa32ba2a 100755 --- a/src/main/java/forestry/factory/gui/ContainerFabricator.java +++ b/src/main/java/forestry/factory/gui/ContainerFabricator.java @@ -20,7 +20,7 @@ public class ContainerFabricator extends ContainerLiquidTanks { private final MachineFabricator tile; - public ContainerFabricator(InventoryPlayer player, MachineFabricator tile) { + public ContainerFabricator(InventoryPlayer playerInventory, MachineFabricator tile) { super(tile, tile); this.tile = tile; @@ -36,7 +36,7 @@ public class ContainerFabricator extends ContainerLiquidTanks { this.addSlot(new Slot(tile, MachineFabricator.SLOT_PLAN, 139, 17)); // Result - this.addSlot(new SlotCrafter(tile, tile, MachineFabricator.SLOT_RESULT, 139, 53)); + this.addSlot(new SlotCrafter(playerInventory.player, tile, tile, MachineFabricator.SLOT_RESULT, 139, 53)); // Crafting matrix for (int l = 0; l < 3; l++) @@ -46,10 +46,10 @@ public class ContainerFabricator extends ContainerLiquidTanks { // Player inventory for (int i = 0; i < 3; i++) for (int k = 0; k < 9; k++) - addSlot(new Slot(player, k + i * 9 + 9, 8 + k * 18, 129 + i * 18)); + addSlot(new Slot(playerInventory, k + i * 9 + 9, 8 + k * 18, 129 + i * 18)); // Player hotbar for (int j = 0; j < 9; j++) - addSlot(new Slot(player, j, 8 + j * 18, 187)); + addSlot(new Slot(playerInventory, j, 8 + j * 18, 187)); } diff --git a/src/main/java/forestry/factory/gui/ContainerWorktable.java b/src/main/java/forestry/factory/gui/ContainerWorktable.java index 62a190aec..472064ebe 100755 --- a/src/main/java/forestry/factory/gui/ContainerWorktable.java +++ b/src/main/java/forestry/factory/gui/ContainerWorktable.java @@ -60,7 +60,7 @@ public class ContainerWorktable extends ContainerForestry implements IContainerC } // CraftResult display - addSlot(new SlotCrafter(craftingInventory, tile, TileWorktable.SLOT_CRAFTING_RESULT, 77, 38)); + addSlot(new SlotCrafter(player, craftingInventory, tile, TileWorktable.SLOT_CRAFTING_RESULT, 77, 38)); // Player inventory for (int i1 = 0; i1 < 3; i1++) {