fix the last fix
@@ -65,18 +65,22 @@ public class UniversalBlockReinforcerItem extends Item
{
BlockState convertedState = ((IReinforcedBlock)rb).getConvertedState(vanillaState);
TileEntity te = world.getTileEntity(pos);
-
- CompoundNBT tag = new CompoundNBT();
+ CompoundNBT tag = null;
if(te != null)
- te.write(tag);
+ {
+ tag = te.write(new CompoundNBT());
if(te instanceof IInventory)
((IInventory)te).clear();
+ }
world.setBlockState(pos, convertedState);
te = world.getTileEntity(pos);
+
+ if(tag != null)
te.read(convertedState, tag);
+
((IOwnable)te).getOwner().set(player.getGameProfile().getId().toString(), player.getName());
player.getHeldItemMainhand().damageItem(1, player, p -> p.sendBreakAnimation(p.getActiveHand()));
return false;
