Compost bin, duplication item
Opened this issue · 5 comments
Can confirm, this issue is very reproducible. It seems to give you exactly 64 times the items you put into it. Works with any compostable item.
Seems to be the result of a hack that was implemented for hopper compat not interacting well with the InventoryHelper's method of dropping items
Proposed solution: replace breakBlock
in BlockCompostBin
with the following:
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
TileEntity tileEntity = worldIn.getTileEntity(pos);
if (tileEntity instanceof IInventory) {
//InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileEntity);
TileEntityCompostBin bin = (TileEntityCompostBin)tileEntity;
NonNullList<ItemStack> inventory = bin.getInventory();
for(ItemStack stack : inventory)
{
ItemStack buffer = stack;
buffer.setCount(1);
bin.getWorld().spawnEntity(new EntityItem(bin.getWorld(), bin.getPos().getX(), bin.getPos().getY(), bin.getPos().getZ(), buffer));
}
worldIn.updateComparatorOutputLevel(pos, this);
}
super.breakBlock(worldIn, pos, state);
}
Requires a getter for the field inventory
in TileEntityCompostBin of course.