Skip to content

Commit

Permalink
Fix crash(ClassCastException) when copying rail
Browse files Browse the repository at this point in the history
  • Loading branch information
Kai-Z-JP committed Jun 13, 2021
1 parent b414576 commit 0823ab2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/jp/ngt/rtm/block/BlockMachineBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ protected boolean clickMachine(World world, int x, int y, int z, EntityPlayer pl

@Override
public int getLightValue(IBlockAccess world, int x, int y, int z) {
TileEntityMachineBase tile = (TileEntityMachineBase) world.getTileEntity(x, y, z);
MachineConfig cfg = tile.getModelSet().getConfig();
return tile.isGettingPower ? cfg.brightness[1] : cfg.brightness[0];
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityMachineBase) {
TileEntityMachineBase tileEntityMachineBase = (TileEntityMachineBase) tile;
MachineConfig cfg = tileEntityMachineBase.getModelSet().getConfig();
return tileEntityMachineBase.isGettingPower ? cfg.brightness[1] : cfg.brightness[0];
} else {
return this.getLightValue();
}
}

@Override
Expand Down

0 comments on commit 0823ab2

Please sign in to comment.