Skip to content

Commit

Permalink
Crash on placing diagonal straights
Browse files Browse the repository at this point in the history
Placement check was broken, would attempt to set a flag to a tile that doesnt exist.
  • Loading branch information
TheDoctor1138 committed Aug 13, 2024
1 parent f6bafab commit 3e26501
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main/java/train/common/items/ItemTCRail.java
Original file line number Diff line number Diff line change
Expand Up @@ -3100,17 +3100,19 @@ private boolean diagonalStraight(EntityPlayer player, World world, int x, int y,
}

for (int i = 0; i <= trackLength; i += 3){
if (!canPlaceTrack(player, world, x + (i * dx), y + 1, z + (i * dz))
|| !canPlaceTrack(player, world, x + (i * dx) + dx, y + 1, z + (i * dz) + dz)
|| !canPlaceTrack(player, world, x + (i * dx) + (2*dx), y + 1, z + (i * dz) + (2*dz)))

if (!canPlaceTrack(player, world, x + (i * dx), y + 1, z + (i * dz))
|| !canPlaceTrack(player, world, x + (i * dx) + dx, y + 1, z + (i * dz) + dz)
|| !canPlaceTrack(player, world, x + (i * dx) + (2*dx), y + 1, z + (i * dz) + (2*dz)))
return false;

for(int j = 0; j < 3 ; j++){
if(!canPlaceTrack(player, world, x + (i * dx) + dx, y + 1, z + (i * dz))
|| !canPlaceTrack(player, world, x + (i * dx) , y + 1, z + (i * dz) + dz))
return false;

if(!canPlaceTrack(player, world, x + (i * dx) + (j * dx ) + dx , y + 1, z + (i * dz) + (j * dz))
|| !canPlaceTrack(player, world, x + (i * dx) + (j * dx), y + 1 , z + (i * dz) + (j * dz) + dz))
return false;
}


}

for (int i = 0; i <= trackLength; i += 3){
Expand Down

0 comments on commit 3e26501

Please sign in to comment.