Skip to content

Commit

Permalink
Fix null tile issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cam72cam committed Sep 10, 2017
1 parent babf73b commit 0a079e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public BlockRail() {
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
TileRail tileEntity = (TileRail) world.getTileEntity(pos);
if (tileEntity != null) {
if (tileEntity != null && tileEntity.getType() != null) {
ItemStack stack = new ItemStack(this, 1, tileEntity.getType().getMeta());
ItemRail.setLength(stack, tileEntity.getLength());
drops.add(stack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ public void readFromNBT(NBTTagCompound nbt) {

@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
if (facing == null) {
// Something is wrong...
ImmersiveRailroading.logger.error("INVALID TILE SAVE");
return super.writeToNBT(nbt);
}
nbt.setByte("facing", (byte) facing.getIndex());
nbt.setString("type", type.name());

Expand Down

0 comments on commit 0a079e8

Please sign in to comment.