This commit is contained in:
Anuken
2024-01-12 15:13:11 -05:00
parent 1d3736cf82
commit b0cc7d2e85
3 changed files with 4 additions and 4 deletions

View File

@@ -33,11 +33,11 @@ public class Fires{
}
public static @Nullable Fire get(Tile tile){
return world.tiles.getFire(tile.array());
return tile == null ? null : world.tiles.getFire(tile.array());
}
public static @Nullable Fire get(int x, int y){
return world.tiles.getFire(world.packArray(x, y));
return Structs.inBounds(x, y, world.width(), world.height()) ? world.tiles.getFire(world.packArray(x, y)) : null;
}
private static void set(Tile tile, Fire fire){

View File

@@ -27,7 +27,7 @@ public class Puddles{
/** Returns the Puddle on the specified tile. May return null. */
public static @Nullable Puddle get(Tile tile){
return world.tiles.getPuddle(tile.array());
return tile == null ? null : world.tiles.getPuddle(tile.array());
}
public static void deposit(Tile tile, Tile source, Liquid liquid, float amount, boolean initial){

View File

@@ -32,7 +32,7 @@ public class Tiles implements Iterable<Tile>{
puddles[pos] = p;
}
public Fire getFire(int pos){
public @Nullable Fire getFire(int pos){
return fires[pos];
}