Using dedicated item handler instances to circumvent FML mapping issues of getStackInSlot().

This commit is contained in:
stfwi 2019-05-19 09:38:25 +02:00
parent 5b1a6e0877
commit dcf8a27d82
7 changed files with 267 additions and 228 deletions

View file

@ -1,7 +1,7 @@
{ {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.12.2": { "1.12.2": {
"1.0.6-b1": "[A] Added small waste incinerator (delayed fifo-buffered item disposal).\n[M] Fixed item/block name capitalization (by Voxelo).\n[M] Metal ladders are easier to break/harvest.", "1.0.6-b1": "[A] Added small waste incinerator (delayed fifo-buffered item disposal).\n[M] Fixed item/block name capitalization (by Voxelo).\n[M] Metal ladders are easier to break/harvest.\n[F] Fixed FML remapping issue by using dedicated IItemHandler instances.",
"1.0.5": "[R] Release based on v1.0.5-b1. Release-to-release changes: * Small electrical passthrough-furnace added. * Passive fluid accumulator added. * Config options added. * Sign plates added. * Minor bug fixes.\n[A] Added sign \"Electrical hazzard\"/\"Caution hot wire\".\n[A] Added sign \"Caution dangerous there\" (skull/bones).", "1.0.5": "[R] Release based on v1.0.5-b1. Release-to-release changes: * Small electrical passthrough-furnace added. * Passive fluid accumulator added. * Config options added. * Sign plates added. * Minor bug fixes.\n[A] Added sign \"Electrical hazzard\"/\"Caution hot wire\".\n[A] Added sign \"Caution dangerous there\" (skull/bones).",
"1.0.5-b1": "[A] Added passive fluid accumulator.\n[A] Added small electrical passthrough-furnace.\n[F] Fixed version check URL.\n[M] Opt-out config options for valves, passive fluid accumulator, and furni.", "1.0.5-b1": "[A] Added passive fluid accumulator.\n[A] Added small electrical passthrough-furnace.\n[F] Fixed version check URL.\n[M] Opt-out config options for valves, passive fluid accumulator, and furni.",
"1.0.4": "[R] Release based on v1.0.4-b9. Release-to-release changes: * Crafting table: Quick crafting history re-fab, JEI integration. * Rendering improvements and issue fixes (stairs, ambient occlusion, optifine, etc). * Walls with texture variations. * Thin/thick steel poles with support feet/heads. * Horizontal steel double-T support beams added. * Fluid pipe valves added: Check valve, redstone controlled valve, analog redstone controlled valve. Support pressurized transfer. * Tool tip documentation (CTRL-SHIFT) for stairs added. * Internal code cleanups. * Recipes tuned.\n[E] Added pass-through electrical furnace (experimental, see config).", "1.0.4": "[R] Release based on v1.0.4-b9. Release-to-release changes: * Crafting table: Quick crafting history re-fab, JEI integration. * Rendering improvements and issue fixes (stairs, ambient occlusion, optifine, etc). * Walls with texture variations. * Thin/thick steel poles with support feet/heads. * Horizontal steel double-T support beams added. * Fluid pipe valves added: Check valve, redstone controlled valve, analog redstone controlled valve. Support pressurized transfer. * Tool tip documentation (CTRL-SHIFT) for stairs added. * Internal code cleanups. * Recipes tuned.\n[E] Added pass-through electrical furnace (experimental, see config).",

View file

@ -13,6 +13,7 @@ Mod sources for Minecraft version 1.12.2.
- v1.0.6-b1 [A] Added small waste incinerator (delayed fifo-buffered item disposal). - v1.0.6-b1 [A] Added small waste incinerator (delayed fifo-buffered item disposal).
[M] Fixed item/block name capitalization (by Voxelo). [M] Fixed item/block name capitalization (by Voxelo).
[M] Metal ladders are easier to break/harvest. [M] Metal ladders are easier to break/harvest.
[F] Fixed FML remapping issue by using dedicated IItemHandler instances.
------------------------------------------------------------------- -------------------------------------------------------------------
- v1.0.5 [R] Release based on v1.0.5-b1. Release-to-release changes: - v1.0.5 [R] Release based on v1.0.5-b1. Release-to-release changes:

View file

@ -391,7 +391,7 @@ public class BlockDecorDropper extends BlockDecorDirected
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickable, ISidedInventory, IItemHandler, Networking.IPacketReceiver public static class BTileEntity extends TileEntity implements ITickable, ISidedInventory, Networking.IPacketReceiver
{ {
public static final int TICK_INTERVAL = 32; public static final int TICK_INTERVAL = 32;
public static final int NUM_OF_SLOTS = 15; public static final int NUM_OF_SLOTS = 15;
@ -666,36 +666,43 @@ public class BlockDecorDropper extends BlockDecorDirected
// IItemHandler -------------------------------------------------------------------------------- // IItemHandler --------------------------------------------------------------------------------
protected static class BItemHandler implements IItemHandler
{
private BTileEntity te;
BItemHandler(BTileEntity te)
{ this.te = te; }
@Override @Override
public int getSlots() public int getSlots()
{ return SIDED_INV_SLOTS.length; } { return SIDED_INV_SLOTS.length; }
@Override @Override
public int getSlotLimit(int index) public int getSlotLimit(int index)
{ return getInventoryStackLimit(); } { return te.getInventoryStackLimit(); }
@Override @Override
public boolean isItemValid(int slot, @Nonnull ItemStack stack) public boolean isItemValid(int slot, @Nonnull ItemStack stack)
{ return is_input_slot(slot); } { return te.is_input_slot(slot); }
@Override @Override
@Nonnull @Nonnull
public ItemStack insertItem(int index, @Nonnull ItemStack stack, boolean simulate) public ItemStack insertItem(int index, @Nonnull ItemStack stack, boolean simulate)
{ {
if((stack.isEmpty()) || (!is_input_slot(index))) return ItemStack.EMPTY; if((stack.isEmpty()) || (!te.is_input_slot(index))) return ItemStack.EMPTY;
int slotno = 0; int slotno = 0;
ItemStack slotstack = getStackInSlot(slotno); ItemStack slotstack = getStackInSlot(slotno);
if(!slotstack.isEmpty()) if(!slotstack.isEmpty())
{ {
if(slotstack.getCount() >= Math.min(slotstack.getMaxStackSize(), getSlotLimit(index))) return stack; if(slotstack.getCount() >= Math.min(slotstack.getMaxStackSize(), getSlotLimit(index))) return stack;
if(!ItemHandlerHelper.canItemStacksStack(stack, slotstack)) return stack; if(!ItemHandlerHelper.canItemStacksStack(stack, slotstack)) return stack;
if(!canInsertItem(slotno, stack, EnumFacing.UP) || (!isItemValidForSlot(slotno, stack))) return stack; if(!te.canInsertItem(slotno, stack, EnumFacing.UP) || (!te.isItemValidForSlot(slotno, stack))) return stack;
int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index)) - slotstack.getCount(); int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index)) - slotstack.getCount();
if(stack.getCount() <= n) { if(stack.getCount() <= n) {
if(!simulate) { if(!simulate) {
ItemStack copy = stack.copy(); ItemStack copy = stack.copy();
copy.grow(slotstack.getCount()); copy.grow(slotstack.getCount());
setInventorySlotContents(slotno, copy); te.setInventorySlotContents(slotno, copy);
} }
return ItemStack.EMPTY; return ItemStack.EMPTY;
} else { } else {
@ -703,7 +710,7 @@ public class BlockDecorDropper extends BlockDecorDirected
if(!simulate) { if(!simulate) {
ItemStack copy = stack.splitStack(n); ItemStack copy = stack.splitStack(n);
copy.grow(slotstack.getCount()); copy.grow(slotstack.getCount());
setInventorySlotContents(slotno, copy); te.setInventorySlotContents(slotno, copy);
return stack; return stack;
} else { } else {
stack.shrink(n); stack.shrink(n);
@ -711,19 +718,19 @@ public class BlockDecorDropper extends BlockDecorDirected
} }
} }
} else { } else {
if(!canInsertItem(slotno, stack, EnumFacing.UP) || (!isItemValidForSlot(slotno, stack))) return stack; if(!te.canInsertItem(slotno, stack, EnumFacing.UP) || (!te.isItemValidForSlot(slotno, stack))) return stack;
int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index)); int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index));
if(n < stack.getCount()) { if(n < stack.getCount()) {
stack = stack.copy(); stack = stack.copy();
if(!simulate) { if(!simulate) {
setInventorySlotContents(slotno, stack.splitStack(n)); te.setInventorySlotContents(slotno, stack.splitStack(n));
return stack; return stack;
} else { } else {
stack.shrink(n); stack.shrink(n);
return stack; return stack;
} }
} else { } else {
if(!simulate) setInventorySlotContents(slotno, stack); if(!simulate) te.setInventorySlotContents(slotno, stack);
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
} }
@ -733,14 +740,22 @@ public class BlockDecorDropper extends BlockDecorDirected
@Nonnull @Nonnull
public ItemStack extractItem(int index, int amount, boolean simulate) public ItemStack extractItem(int index, int amount, boolean simulate)
{ {
if((amount <= 0) || (!is_input_slot(index))) return ItemStack.EMPTY; if((amount <= 0) || (!te.is_input_slot(index))) return ItemStack.EMPTY;
ItemStack stack = stacks_.get(index).copy(); ItemStack stack = te.stacks_.get(index).copy();
if(stack.getCount() > amount) stack.setCount(amount); if(stack.getCount() > amount) stack.setCount(amount);
if(simulate) return stack; if(simulate) return stack;
stacks_.get(index).shrink(stack.getCount()); te.stacks_.get(index).shrink(stack.getCount());
return stack; return stack;
} }
@Override
@Nonnull
public ItemStack getStackInSlot(int index)
{ return te.getStackInSlot(index); }
}
BItemHandler item_handler_ = new BItemHandler(this);
// Capability export ---------------------------------------------------------------------------- // Capability export ----------------------------------------------------------------------------
@Override @Override
@ -752,12 +767,9 @@ public class BlockDecorDropper extends BlockDecorDirected
@Nullable @Nullable
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{ {
if((facing != null) && (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)) { if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return (T)item_handler_;
return (T)this;
} else {
return super.getCapability(capability, facing); return super.getCapability(capability, facing);
} }
}
// IPacketReceiver ------------------------------------------------------------------------------- // IPacketReceiver -------------------------------------------------------------------------------

View file

@ -452,12 +452,6 @@ public class BlockDecorFurnace extends BlockDecorDirected
public static final int AUX_0_SLOT_NO = 9; public static final int AUX_0_SLOT_NO = 9;
public static final int AUX_1_SLOT_NO =10; public static final int AUX_1_SLOT_NO =10;
private static final int[] SLOTS_TOP = new int[] {FIFO_INPUT_1_SLOT_NO};
private static final int[] SLOTS_BOTTOM = new int[] {FIFO_OUTPUT_1_SLOT_NO};
private static final int[] SLOTS_SIDES = new int[] {FIFO_FUEL_1_SLOT_NO};
private final IItemHandler sided_itemhandler_top_ = new SidedInvWrapper(this, EnumFacing.UP);
private final IItemHandler sided_itemhandler_down_ = new SidedInvWrapper(this, EnumFacing.DOWN);
private final IItemHandler sided_itemhandler_sides_ = new SidedInvWrapper(this, EnumFacing.WEST);
private static double proc_fuel_efficiency_ = 1.0; private static double proc_fuel_efficiency_ = 1.0;
private static int proc_speed_interval_ = DEFAULT_SPEED_INTERVAL; private static int proc_speed_interval_ = DEFAULT_SPEED_INTERVAL;
private static int boost_energy_consumption = DEFAULT_BOOST_ENERGY * TICK_INTERVAL; private static int boost_energy_consumption = DEFAULT_BOOST_ENERGY * TICK_INTERVAL;
@ -725,6 +719,13 @@ public class BlockDecorFurnace extends BlockDecorDirected
// ISidedInventory ---------------------------------------------------------------------------- // ISidedInventory ----------------------------------------------------------------------------
private static final int[] SLOTS_TOP = new int[] {FIFO_INPUT_1_SLOT_NO};
private static final int[] SLOTS_BOTTOM = new int[] {FIFO_OUTPUT_1_SLOT_NO};
private static final int[] SLOTS_SIDES = new int[] {FIFO_FUEL_1_SLOT_NO};
private final IItemHandler sided_itemhandler_top_ = new SidedInvWrapper(this, EnumFacing.UP);
private final IItemHandler sided_itemhandler_down_ = new SidedInvWrapper(this, EnumFacing.DOWN);
private final IItemHandler sided_itemhandler_sides_ = new SidedInvWrapper(this, EnumFacing.WEST);
@Override @Override
public int[] getSlotsForFace(EnumFacing side) public int[] getSlotsForFace(EnumFacing side)
{ {

View file

@ -273,7 +273,7 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends BlockDecorFurnace.BTileEntity implements ITickable, ISidedInventory, IEnergyStorage, IItemHandler public static class BTileEntity extends BlockDecorFurnace.BTileEntity implements ITickable, ISidedInventory, IEnergyStorage
{ {
public static final int TICK_INTERVAL = 4; public static final int TICK_INTERVAL = 4;
public static final int FIFO_INTERVAL = 20; public static final int FIFO_INTERVAL = 20;
@ -429,6 +429,10 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
return changed; return changed;
} }
@Override
public ItemStack getStackInSlot(int index)
{ return ((index < 0) || (index >= SIDED_INV_SLOTS.length)) ? ItemStack.EMPTY : stacks_.get(SIDED_INV_SLOTS[index]); }
// ISidedInventory ---------------------------------------------------------------------------- // ISidedInventory ----------------------------------------------------------------------------
private static final int[] SIDED_INV_SLOTS = new int[] { private static final int[] SIDED_INV_SLOTS = new int[] {
@ -482,6 +486,13 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
// IItemHandler -------------------------------------------------------------------------------- // IItemHandler --------------------------------------------------------------------------------
protected static class BItemHandler implements IItemHandler
{
private BTileEntity te;
BItemHandler(BTileEntity te)
{ this.te = te; }
@Override @Override
public int getSlots() public int getSlots()
{ return SIDED_INV_SLOTS.length; } { return SIDED_INV_SLOTS.length; }
@ -489,11 +500,11 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
@Override @Override
@Nonnull @Nonnull
public ItemStack getStackInSlot(int index) public ItemStack getStackInSlot(int index)
{ return ((index < 0) || (index >= SIDED_INV_SLOTS.length)) ? ItemStack.EMPTY : stacks_.get(SIDED_INV_SLOTS[index]); } { return te.getStackInSlot(index); }
@Override @Override
public int getSlotLimit(int index) public int getSlotLimit(int index)
{ return getInventoryStackLimit(); } { return te.getInventoryStackLimit(); }
@Override @Override
public boolean isItemValid(int slot, @Nonnull ItemStack stack) public boolean isItemValid(int slot, @Nonnull ItemStack stack)
@ -507,17 +518,16 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
if((index < 0) || (index >= SIDED_INV_SLOTS.length)) return ItemStack.EMPTY; if((index < 0) || (index >= SIDED_INV_SLOTS.length)) return ItemStack.EMPTY;
int slotno = SIDED_INV_SLOTS[index]; int slotno = SIDED_INV_SLOTS[index];
ItemStack slotstack = getStackInSlot(slotno); ItemStack slotstack = getStackInSlot(slotno);
if(!slotstack.isEmpty()) if(!slotstack.isEmpty()) {
{
if(slotstack.getCount() >= Math.min(slotstack.getMaxStackSize(), getSlotLimit(index))) return stack; if(slotstack.getCount() >= Math.min(slotstack.getMaxStackSize(), getSlotLimit(index))) return stack;
if(!ItemHandlerHelper.canItemStacksStack(stack, slotstack)) return stack; if(!ItemHandlerHelper.canItemStacksStack(stack, slotstack)) return stack;
if(!canInsertItem(slotno, stack, EnumFacing.UP) || (!isItemValidForSlot(slotno, stack))) return stack; if(!te.canInsertItem(slotno, stack, EnumFacing.UP) || (!te.isItemValidForSlot(slotno, stack))) return stack;
int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index)) - slotstack.getCount(); int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index)) - slotstack.getCount();
if(stack.getCount() <= n) { if(stack.getCount() <= n) {
if(!simulate) { if(!simulate) {
ItemStack copy = stack.copy(); ItemStack copy = stack.copy();
copy.grow(slotstack.getCount()); copy.grow(slotstack.getCount());
setInventorySlotContents(slotno, copy); te.setInventorySlotContents(slotno, copy);
} }
return ItemStack.EMPTY; return ItemStack.EMPTY;
} else { } else {
@ -525,7 +535,7 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
if(!simulate) { if(!simulate) {
ItemStack copy = stack.splitStack(n); ItemStack copy = stack.splitStack(n);
copy.grow(slotstack.getCount()); copy.grow(slotstack.getCount());
setInventorySlotContents(slotno, copy); te.setInventorySlotContents(slotno, copy);
return stack; return stack;
} else { } else {
stack.shrink(n); stack.shrink(n);
@ -533,19 +543,19 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
} }
} }
} else { } else {
if(!canInsertItem(slotno, stack, EnumFacing.UP) || (!isItemValidForSlot(slotno, stack))) return stack; if(!te.canInsertItem(slotno, stack, EnumFacing.UP) || (!te.isItemValidForSlot(slotno, stack))) return stack;
int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index)); int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index));
if(n < stack.getCount()) { if(n < stack.getCount()) {
stack = stack.copy(); stack = stack.copy();
if(!simulate) { if(!simulate) {
setInventorySlotContents(slotno, stack.splitStack(n)); te.setInventorySlotContents(slotno, stack.splitStack(n));
return stack; return stack;
} else { } else {
stack.shrink(n); stack.shrink(n);
return stack; return stack;
} }
} else { } else {
if(!simulate) setInventorySlotContents(slotno, stack); if(!simulate) te.setInventorySlotContents(slotno, stack);
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
} }
@ -553,25 +563,27 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
@Override @Override
@Nonnull @Nonnull
public ItemStack extractItem(int index, int amount, boolean simulate) public ItemStack extractItem(int index, int amount, boolean simulate) {
{
if(amount == 0) return ItemStack.EMPTY; if(amount == 0) return ItemStack.EMPTY;
if((index < 0) || (index >= SIDED_INV_SLOTS.length)) return ItemStack.EMPTY; if((index < 0) || (index >= SIDED_INV_SLOTS.length)) return ItemStack.EMPTY;
int slotno = SIDED_INV_SLOTS[index]; int slotno = SIDED_INV_SLOTS[index];
ItemStack stackInSlot = getStackInSlot(slotno); ItemStack stackInSlot = getStackInSlot(slotno);
if(stackInSlot.isEmpty()) return ItemStack.EMPTY; if(stackInSlot.isEmpty()) return ItemStack.EMPTY;
if(!canExtractItem(slotno, stackInSlot, EnumFacing.DOWN)) return ItemStack.EMPTY; if(!te.canExtractItem(slotno, stackInSlot, EnumFacing.DOWN)) return ItemStack.EMPTY;
if(simulate) { if(simulate) {
if(stackInSlot.getCount() < amount) return stackInSlot.copy(); if(stackInSlot.getCount() < amount) return stackInSlot.copy();
ItemStack ostack = stackInSlot.copy(); ItemStack ostack = stackInSlot.copy();
ostack.setCount(amount); ostack.setCount(amount);
return ostack; return ostack;
} else { } else {
ItemStack ostack = decrStackSize(slotno, Math.min(stackInSlot.getCount(), amount)); ItemStack ostack = te.decrStackSize(slotno, Math.min(stackInSlot.getCount(), amount));
markDirty(); te.markDirty();
return ostack; return ostack;
} }
} }
}
protected BItemHandler item_handler_ = new BItemHandler(this);
// Capability export ---------------------------------------------------------------------------- // Capability export ----------------------------------------------------------------------------
@ -584,12 +596,10 @@ public class BlockDecorFurnaceElectrical extends BlockDecorFurnace
@Nullable @Nullable
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{ {
if((capability == CapabilityEnergy.ENERGY) || (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)) { if(capability == CapabilityEnergy.ENERGY) return ((T)this);
return ((T)this); if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return (T)item_handler_;
} else {
return super.getCapability(capability, facing); return super.getCapability(capability, facing);
} }
}
// ITickable ------------------------------------------------------------------------------------ // ITickable ------------------------------------------------------------------------------------

View file

@ -303,7 +303,7 @@ public class BlockDecorWasteIncinerator extends BlockDecor
// Tile entity // Tile entity
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
public static class BTileEntity extends TileEntity implements ITickable, ISidedInventory, IEnergyStorage, IItemHandler public static class BTileEntity extends TileEntity implements ITickable, ISidedInventory, IEnergyStorage
{ {
public static final int TICK_INTERVAL = 20; public static final int TICK_INTERVAL = 20;
public static final int ENERGIZED_TICK_INTERVAL = 5; public static final int ENERGIZED_TICK_INTERVAL = 5;
@ -449,8 +449,8 @@ public class BlockDecorWasteIncinerator extends BlockDecor
@Override @Override
public void setInventorySlotContents(int index, ItemStack stack) public void setInventorySlotContents(int index, ItemStack stack)
{ {
stacks_.set(index, stack);
if(stack.getCount() > getInventoryStackLimit()) stack.setCount(getInventoryStackLimit()); if(stack.getCount() > getInventoryStackLimit()) stack.setCount(getInventoryStackLimit());
stacks_.set(index, stack);
markDirty(); markDirty();
} }
@ -476,7 +476,7 @@ public class BlockDecorWasteIncinerator extends BlockDecor
@Override @Override
public boolean isItemValidForSlot(int index, ItemStack stack) public boolean isItemValidForSlot(int index, ItemStack stack)
{ return index==0; } { return (index==0); }
@Override @Override
public int getField(int id) public int getField(int id)
@ -544,13 +544,20 @@ public class BlockDecorWasteIncinerator extends BlockDecor
// IItemHandler -------------------------------------------------------------------------------- // IItemHandler --------------------------------------------------------------------------------
protected static class BItemHandler implements IItemHandler
{
private BTileEntity te;
BItemHandler(BTileEntity te)
{ this.te = te; }
@Override @Override
public int getSlots() public int getSlots()
{ return 1; } { return 1; }
@Override @Override
public int getSlotLimit(int index) public int getSlotLimit(int index)
{ return getInventoryStackLimit(); } { return te.getInventoryStackLimit(); }
@Override @Override
public boolean isItemValid(int slot, @Nonnull ItemStack stack) public boolean isItemValid(int slot, @Nonnull ItemStack stack)
@ -568,13 +575,13 @@ public class BlockDecorWasteIncinerator extends BlockDecor
{ {
if(slotstack.getCount() >= Math.min(slotstack.getMaxStackSize(), getSlotLimit(index))) return stack; if(slotstack.getCount() >= Math.min(slotstack.getMaxStackSize(), getSlotLimit(index))) return stack;
if(!ItemHandlerHelper.canItemStacksStack(stack, slotstack)) return stack; if(!ItemHandlerHelper.canItemStacksStack(stack, slotstack)) return stack;
if(!canInsertItem(slotno, stack, EnumFacing.UP) || (!isItemValidForSlot(slotno, stack))) return stack; if(!te.canInsertItem(slotno, stack, EnumFacing.UP) || (!te.isItemValidForSlot(slotno, stack))) return stack;
int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index)) - slotstack.getCount(); int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index)) - slotstack.getCount();
if(stack.getCount() <= n) { if(stack.getCount() <= n) {
if(!simulate) { if(!simulate) {
ItemStack copy = stack.copy(); ItemStack copy = stack.copy();
copy.grow(slotstack.getCount()); copy.grow(slotstack.getCount());
setInventorySlotContents(slotno, copy); te.setInventorySlotContents(slotno, copy);
} }
return ItemStack.EMPTY; return ItemStack.EMPTY;
} else { } else {
@ -582,7 +589,7 @@ public class BlockDecorWasteIncinerator extends BlockDecor
if(!simulate) { if(!simulate) {
ItemStack copy = stack.splitStack(n); ItemStack copy = stack.splitStack(n);
copy.grow(slotstack.getCount()); copy.grow(slotstack.getCount());
setInventorySlotContents(slotno, copy); te.setInventorySlotContents(slotno, copy);
return stack; return stack;
} else { } else {
stack.shrink(n); stack.shrink(n);
@ -590,19 +597,19 @@ public class BlockDecorWasteIncinerator extends BlockDecor
} }
} }
} else { } else {
if(!canInsertItem(slotno, stack, EnumFacing.UP) || (!isItemValidForSlot(slotno, stack))) return stack; if(!te.canInsertItem(slotno, stack, EnumFacing.UP) || (!te.isItemValidForSlot(slotno, stack))) return stack;
int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index)); int n = Math.min(stack.getMaxStackSize(), getSlotLimit(index));
if(n < stack.getCount()) { if(n < stack.getCount()) {
stack = stack.copy(); stack = stack.copy();
if(!simulate) { if(!simulate) {
setInventorySlotContents(slotno, stack.splitStack(n)); te.setInventorySlotContents(slotno, stack.splitStack(n));
return stack; return stack;
} else { } else {
stack.shrink(n); stack.shrink(n);
return stack; return stack;
} }
} else { } else {
if(!simulate) setInventorySlotContents(slotno, stack); if(!simulate) te.setInventorySlotContents(slotno, stack);
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
} }
@ -613,6 +620,14 @@ public class BlockDecorWasteIncinerator extends BlockDecor
public ItemStack extractItem(int index, int amount, boolean simulate) public ItemStack extractItem(int index, int amount, boolean simulate)
{ return ItemStack.EMPTY; } { return ItemStack.EMPTY; }
@Override
@Nonnull
public ItemStack getStackInSlot(int index)
{ return te.getStackInSlot(index); }
}
private BItemHandler item_handler_ = new BItemHandler(this);
// Capability export ---------------------------------------------------------------------------- // Capability export ----------------------------------------------------------------------------
@Override @Override
@ -625,7 +640,7 @@ public class BlockDecorWasteIncinerator extends BlockDecor
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{ {
if((facing != null) && (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)) { if((facing != null) && (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)) {
return (T)this; return (T)item_handler_;
} else if(capability == CapabilityEnergy.ENERGY) { } else if(capability == CapabilityEnergy.ENERGY) {
return (T)this; return (T)this;
} else { } else {

View file

@ -1,7 +1,7 @@
{ {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/", "homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"1.12.2": { "1.12.2": {
"1.0.6-b1": "[A] Added small waste incinerator (delayed fifo-buffered item disposal).\n[M] Fixed item/block name capitalization (by Voxelo).\n[M] Metal ladders are easier to break/harvest.", "1.0.6-b1": "[A] Added small waste incinerator (delayed fifo-buffered item disposal).\n[M] Fixed item/block name capitalization (by Voxelo).\n[M] Metal ladders are easier to break/harvest.\n[F] Fixed FML remapping issue by using dedicated IItemHandler instances.",
"1.0.5": "[R] Release based on v1.0.5-b1. Release-to-release changes: * Small electrical passthrough-furnace added. * Passive fluid accumulator added. * Config options added. * Sign plates added. * Minor bug fixes.\n[A] Added sign \"Electrical hazzard\"/\"Caution hot wire\".\n[A] Added sign \"Caution dangerous there\" (skull/bones).", "1.0.5": "[R] Release based on v1.0.5-b1. Release-to-release changes: * Small electrical passthrough-furnace added. * Passive fluid accumulator added. * Config options added. * Sign plates added. * Minor bug fixes.\n[A] Added sign \"Electrical hazzard\"/\"Caution hot wire\".\n[A] Added sign \"Caution dangerous there\" (skull/bones).",
"1.0.5-b1": "[A] Added passive fluid accumulator.\n[A] Added small electrical passthrough-furnace.\n[F] Fixed version check URL.\n[M] Opt-out config options for valves, passive fluid accumulator, and furni.", "1.0.5-b1": "[A] Added passive fluid accumulator.\n[A] Added small electrical passthrough-furnace.\n[F] Fixed version check URL.\n[M] Opt-out config options for valves, passive fluid accumulator, and furni.",
"1.0.4": "[R] Release based on v1.0.4-b9. Release-to-release changes: * Crafting table: Quick crafting history re-fab, JEI integration. * Rendering improvements and issue fixes (stairs, ambient occlusion, optifine, etc). * Walls with texture variations. * Thin/thick steel poles with support feet/heads. * Horizontal steel double-T support beams added. * Fluid pipe valves added: Check valve, redstone controlled valve, analog redstone controlled valve. Support pressurized transfer. * Tool tip documentation (CTRL-SHIFT) for stairs added. * Internal code cleanups. * Recipes tuned.\n[E] Added pass-through electrical furnace (experimental, see config).", "1.0.4": "[R] Release based on v1.0.4-b9. Release-to-release changes: * Crafting table: Quick crafting history re-fab, JEI integration. * Rendering improvements and issue fixes (stairs, ambient occlusion, optifine, etc). * Walls with texture variations. * Thin/thick steel poles with support feet/heads. * Horizontal steel double-T support beams added. * Fluid pipe valves added: Check valve, redstone controlled valve, analog redstone controlled valve. Support pressurized transfer. * Tool tip documentation (CTRL-SHIFT) for stairs added. * Internal code cleanups. * Recipes tuned.\n[E] Added pass-through electrical furnace (experimental, see config).",