Skip to content

Commit

Permalink
track crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
EternalBlueFlame committed Oct 7, 2024
1 parent efd8a64 commit 4a60dc0
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/main/java/train/common/blocks/BlockTCRail.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,13 @@ public boolean hasTileEntity(int metadata) {

@Override
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
TileTCRail tileEntity = (TileTCRail) world.getTileEntity(x,y,z);
if (tileEntity == null){
return;
TileEntity tileEntity = world.getTileEntity(x,y,z);
if (tileEntity instanceof TileTCRailGag) {
tileEntity = world.getTileEntity(((TileTCRailGag)tileEntity).originX, ((TileTCRailGag)tileEntity).originY, ((TileTCRailGag)tileEntity).originZ);
}
if(tileEntity instanceof TileTCRail){
((TileTCRail)tileEntity).lastPlayerToInteract = player;
}

if (tileEntity.isLinkedToRail){
TileTCRailGag tileGag = (TileTCRailGag) world.getTileEntity(tileEntity.linkedX, tileEntity.linkedY, tileEntity.linkedZ);
tileEntity = (TileTCRail) world.getTileEntity(tileGag.originX, tileGag.originY, tileGag.originZ);
}
tileEntity.lastPlayerToInteract = player;


}
Expand Down

0 comments on commit 4a60dc0

Please sign in to comment.