i fixed a null pointer exception in getLocation of job Smile

stable
mal 2023-10-20 17:39:52 -04:00
parent c4bfd44cc9
commit 4dff9566a4
1 changed files with 9 additions and 5 deletions

View File

@ -120,11 +120,15 @@ public class Job extends GameObject {
}
public Vector2i[] getLocations() {
Stockpile pile = that.get(Stockpile.class);
// Vector4f box = pile.getWorldBox().toXYWH();
return new Vector2i[] {
pile.getFreeTile()
};
List<Stockpile> stockpiles = that.getAll(Stockpile.class);
for(Stockpile pile : stockpiles) {
Vector2i tile = pile.getFreeTile();
if(tile == null) continue;
return new Vector2i[] {
tile
};
}
return new Vector2i[] {};
}
@Override