Add null check to creating default NBT data

This commit is contained in:
dordsor21
2021-06-10 19:59:17 +01:00
parent 717a1b5db4
commit f6c87b6726
6 changed files with 13 additions and 6 deletions

View File

@ -39,7 +39,7 @@ public class BlockMaterial_1_15_2 implements BlockMaterial {
this.isTranslucent = !(boolean) ReflectionUtil.getField(Block.class, block, "v");
opacity = defaultState.b(BlockAccessAir.INSTANCE, BlockPosition.ZERO);
TileEntity tileEntity = !block.isTileEntity() ? null : ((ITileEntity)block).createTile(null);
tile = new LazyCompoundTag_1_15_2(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
tile = tileEntity == null ? null : new LazyCompoundTag_1_15_2(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
}
public Block getBlock() {

View File

@ -41,7 +41,7 @@ public class BlockMaterial_1_16_1 implements BlockMaterial {
this.isTranslucent = !(boolean)ReflectionUtil.getField(BlockBase.Info.class, blockInfo, "n");
opacity = defaultState.b(BlockAccessAir.INSTANCE, BlockPosition.ZERO);
TileEntity tileEntity = !block.isTileEntity() ? null : ((ITileEntity)block).createTile(null);
tile = new LazyCompoundTag_1_16_1(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
tile = tileEntity == null ? null : new LazyCompoundTag_1_16_1(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
}
public Block getBlock() {

View File

@ -41,7 +41,7 @@ public class BlockMaterial_1_16_2 implements BlockMaterial {
this.isTranslucent = !(boolean)ReflectionUtil.getField(BlockBase.Info.class, blockInfo, "n");
opacity = defaultState.b(BlockAccessAir.INSTANCE, BlockPosition.ZERO);
TileEntity tileEntity = !block.isTileEntity() ? null : ((ITileEntity)block).createTile(null);
tile = new LazyCompoundTag_1_16_2(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
tile = tileEntity == null ? null : new LazyCompoundTag_1_16_2(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
}
public Block getBlock() {

View File

@ -41,7 +41,7 @@ public class BlockMaterial_1_16_5 implements BlockMaterial {
this.isTranslucent = !(boolean)ReflectionUtil.getField(BlockBase.Info.class, blockInfo, "n");
opacity = defaultState.b(BlockAccessAir.INSTANCE, BlockPosition.ZERO);
TileEntity tileEntity = !block.isTileEntity() ? null : ((ITileEntity)block).createTile(null);
tile = new LazyCompoundTag_1_16_5(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
tile = tileEntity == null ? null : new LazyCompoundTag_1_16_5(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
}
public Block getBlock() {