diff --git a/src/main/java/tconstruct/smeltery/logic/CastingBlockLogic.java b/src/main/java/tconstruct/smeltery/logic/CastingBlockLogic.java index 123b2097..cb37d4dc 100644 --- a/src/main/java/tconstruct/smeltery/logic/CastingBlockLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/CastingBlockLogic.java @@ -185,6 +185,7 @@ public abstract class CastingBlockLogic extends InventoryLogic worldObj.func_147479_m(xCoord, yCoord, zCoord); this.liquid = copyLiquid; needsUpdate = true; + markDirty(); } return copyLiquid.amount; } else { @@ -200,6 +201,7 @@ public abstract class CastingBlockLogic extends InventoryLogic this.liquid.amount = this.capacity; worldObj.func_147479_m(xCoord, yCoord, zCoord); needsUpdate = true; + markDirty(); } return roomInTank; } else { @@ -208,6 +210,7 @@ public abstract class CastingBlockLogic extends InventoryLogic this.liquid.amount += resource.amount; worldObj.func_147479_m(xCoord, yCoord, zCoord); needsUpdate = true; + markDirty(); } return resource.amount; } @@ -226,6 +229,7 @@ public abstract class CastingBlockLogic extends InventoryLogic if (doDrain) { liquid.amount -= used; + markDirty(); } FluidStack drained = liquid.copy(); @@ -271,9 +275,12 @@ public abstract class CastingBlockLogic extends InventoryLogic stack, player); MinecraftForge.EVENT_BUS.post(event); - if (!event.isCanceled()) setInventorySlotContents(0, event.item); - else player.inventory.addItemStackToInventory(stack); // should never return false, since the itemstack was - // taken from the inventory + if (!event.isCanceled()) { + setInventorySlotContents(0, event.item); + markDirty(); + } else { + player.inventory.addItemStackToInventory(stack); + } } // take stuff out. else { @@ -300,6 +307,7 @@ public abstract class CastingBlockLogic extends InventoryLogic // remove inventory contents, since we spilled the full contents of the slot inventory[slot] = null; + markDirty(); } } @@ -416,6 +424,7 @@ public abstract class CastingBlockLogic extends InventoryLogic } liquid = null; + markDirty(); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } diff --git a/src/main/java/tconstruct/tools/inventory/CraftingStationContainer.java b/src/main/java/tconstruct/tools/inventory/CraftingStationContainer.java index d774dcdc..3918cccb 100644 --- a/src/main/java/tconstruct/tools/inventory/CraftingStationContainer.java +++ b/src/main/java/tconstruct/tools/inventory/CraftingStationContainer.java @@ -171,12 +171,7 @@ public class CraftingStationContainer extends Container { if (index == 0) { // Crafting Result if (ret.getItem() instanceof IModifyable) { - nothingDone &= !this.mergeCraftedStack( - itemstack, - logic.getSizeInventory(), - this.inventorySlots.size(), - true, - entityPlayer); + nothingDone &= !this.mergeCraftedStack(itemstack, logic.getSizeInventory(), 46, true, entityPlayer); } else { // First refill the attached chests nothingDone &= this.refillChest(itemstack); diff --git a/src/main/java/tconstruct/tools/inventory/PatternShaperChestContainer.java b/src/main/java/tconstruct/tools/inventory/PatternShaperChestContainer.java index f30569a3..a6c396f8 100644 --- a/src/main/java/tconstruct/tools/inventory/PatternShaperChestContainer.java +++ b/src/main/java/tconstruct/tools/inventory/PatternShaperChestContainer.java @@ -24,7 +24,7 @@ public class PatternShaperChestContainer extends Container { PatternChestLogic pLogic) { this.logic = shaper; this.patternLogic = pLogic; - this.addSlotToContainer(new Slot(shaper, 0, 48, 35)); + this.addSlotToContainer(new SlotBlankPattern(shaper, 0, 48, 35)); this.addSlotToContainer(new SlotOnlyTake(shaper, 1, 106, 35)); /* * for (int i = 0; i < 3; i++) { for (int l = 0; l < 3; l++) { this.addSlotToContainer(new Slot(craftMatrix, l + @@ -92,6 +92,9 @@ public class PatternShaperChestContainer extends Container { return null; } } else if (slotId < logic.getSizeInventory()) { + if (slotId == 1 && !(stack.getItem() instanceof IPattern)) { + return null; + } if (stack.getItem() instanceof IPattern) { // pattern slot, search from pattern chest first if (!this.mergeItemStack(stack, 4 * 9 + 2, this.inventorySlots.size(), false)) { diff --git a/src/main/java/tconstruct/tools/inventory/PatternShaperContainer.java b/src/main/java/tconstruct/tools/inventory/PatternShaperContainer.java index 88910714..1e86a8f0 100644 --- a/src/main/java/tconstruct/tools/inventory/PatternShaperContainer.java +++ b/src/main/java/tconstruct/tools/inventory/PatternShaperContainer.java @@ -20,7 +20,7 @@ public class PatternShaperContainer extends Container { public PatternShaperContainer(InventoryPlayer inventoryplayer, StencilTableLogic shaper) { logic = shaper; - this.addSlotToContainer(new Slot(shaper, 0, 48, 35)); + this.addSlotToContainer(new SlotBlankPattern(shaper, 0, 48, 35)); this.addSlotToContainer(new SlotOnlyTake(shaper, 1, 106, 35)); /* * for (int i = 0; i < 3; i++) { for (int l = 0; l < 3; l++) { this.addSlotToContainer(new Slot(craftMatrix, l + @@ -77,6 +77,9 @@ public class PatternShaperContainer extends Container { } } else if (slotId < logic.getSizeInventory()) { // pattern slot + if (slotId == 1 && !(stack.getItem() instanceof IPattern)) { + return null; + } if (!this.mergeItemStack(stack, 2, this.inventorySlots.size(), false)) { return null; } diff --git a/src/main/java/tconstruct/tools/inventory/SlotBlankPattern.java b/src/main/java/tconstruct/tools/inventory/SlotBlankPattern.java new file mode 100644 index 00000000..6d7ec52a --- /dev/null +++ b/src/main/java/tconstruct/tools/inventory/SlotBlankPattern.java @@ -0,0 +1,22 @@ +package tconstruct.tools.inventory; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import tconstruct.library.crafting.StencilBuilder; + +/** + * Input slot for the stencil table. Only accepts blank patterns. + */ +public class SlotBlankPattern extends Slot { + + public SlotBlankPattern(IInventory builder, int par3, int par4, int par5) { + super(builder, par3, par4, par5); + } + + @Override + public boolean isItemValid(ItemStack stack) { + return stack != null && StencilBuilder.isBlank(stack); + } +} diff --git a/src/main/java/tconstruct/tools/logic/StencilTableLogic.java b/src/main/java/tconstruct/tools/logic/StencilTableLogic.java index fb40b699..5724389a 100644 --- a/src/main/java/tconstruct/tools/logic/StencilTableLogic.java +++ b/src/main/java/tconstruct/tools/logic/StencilTableLogic.java @@ -79,10 +79,6 @@ public class StencilTableLogic extends InventoryLogic implements ISidedInventory if (slot == 0) { if (itemstack != null && StencilBuilder.isBlank(itemstack)) { super.setInventorySlotContents(1, selectedStack); - } else if (itemstack != null) { - ItemStack cpy = itemstack.copy(); - cpy.stackSize = 1; - super.setInventorySlotContents(1, cpy); } else { super.setInventorySlotContents(1, null); }