mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-28 07:56:01 +00:00
Multiple dupe/void Fix (#296)
This commit is contained in:
1 parent
ed248b2418
commit
89c03e63e4
6 files changed
+43
-15
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user