mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Save and restore full state when mossifying an altar, fixes #3154
This commit is contained in:
1 parent
3b250ae1c2
commit
830b87db40
1 file changed
+4
-9
@@ -89,21 +89,16 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
if(world.isRemote || stack.isEmpty() || !item.isAlive())
|
||||
return false;
|
||||
|
||||
if(getBlockState().getBlock() == ModBlocks.defaultAltar && stack.getItem() == Item.getItemFromBlock(Blocks.VINE)) {
|
||||
ItemStack[] tmp = new ItemStack[getSizeInventory()];
|
||||
for(int i = 0; i < getSizeInventory(); i++) {
|
||||
tmp[i] = itemHandler.getStackInSlot(i);
|
||||
itemHandler.setStackInSlot(i, ItemStack.EMPTY);
|
||||
}
|
||||
if(getBlockState().getBlock() == ModBlocks.defaultAltar && stack.getItem() == Blocks.VINE.asItem()) {
|
||||
CompoundNBT tmp = new CompoundNBT();
|
||||
writePacketNBT(tmp);
|
||||
|
||||
stack.shrink(1);
|
||||
world.setBlockState(getPos(), ModBlocks.mossyAltar.getDefaultState());
|
||||
|
||||
TileEntity newAltar = world.getTileEntity(getPos());
|
||||
if(newAltar instanceof TileAltar) {
|
||||
for(int i = 0; i < getSizeInventory(); i++) {
|
||||
((TileAltar) newAltar).getItemHandler().setStackInSlot(i, tmp[i]);
|
||||
}
|
||||
((TileAltar) newAltar).readPacketNBT(tmp);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user