Crash fixes
This commit is contained in:
@@ -119,7 +119,7 @@ public class BlockIndexer{
|
|||||||
* Get all allied blocks with a flag.
|
* Get all allied blocks with a flag.
|
||||||
*/
|
*/
|
||||||
public ObjectSet<Tile> getAllied(Team team, BlockFlag type){
|
public ObjectSet<Tile> getAllied(Team team, BlockFlag type){
|
||||||
return (state.teams.get(team).ally ? allyMap : enemyMap).get(type, emptyArray);
|
return state.teams.has(team) ? (state.teams.get(team).ally ? allyMap : enemyMap).get(type, emptyArray) : emptyArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,7 +142,7 @@ public class BlockIndexer{
|
|||||||
for(int ty = ry * structQuadrantSize; ty < (ry + 1) * structQuadrantSize && ty < world.height(); ty++){
|
for(int ty = ry * structQuadrantSize; ty < (ry + 1) * structQuadrantSize && ty < world.height(); ty++){
|
||||||
Tile other = world.tile(tx, ty);
|
Tile other = world.tile(tx, ty);
|
||||||
|
|
||||||
if(other == null || other.entity == null || other.getTeam() != team || !pred.test(other)) continue;
|
if(other == null || other.entity == null || !pred.test(other)) continue;
|
||||||
|
|
||||||
TileEntity e = other.entity;
|
TileEntity e = other.entity;
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public abstract class InputHandler extends InputAdapter{
|
|||||||
ItemTransfer.create(stack.item,
|
ItemTransfer.create(stack.item,
|
||||||
player.x + Angles.trnsx(player.rotation + 180f, backTrns), player.y + Angles.trnsy(player.rotation + 180f, backTrns),
|
player.x + Angles.trnsx(player.rotation + 180f, backTrns), player.y + Angles.trnsy(player.rotation + 180f, backTrns),
|
||||||
new Translator(tile.drawx() + stackTrns.x, tile.drawy() + stackTrns.y), () -> {
|
new Translator(tile.drawx() + stackTrns.x, tile.drawy() + stackTrns.y), () -> {
|
||||||
if(tile.block() != block) return;
|
if(tile.block() != block || tile.entity == null) return;
|
||||||
|
|
||||||
tile.block().handleStack(stack.item, removed, tile, player);
|
tile.block().handleStack(stack.item, removed, tile, player);
|
||||||
remaining[1] -= removed;
|
remaining[1] -= removed;
|
||||||
|
|||||||
@@ -74,7 +74,9 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
|
|
||||||
add.shown(() -> {
|
add.shown(() -> {
|
||||||
add.getTitleLabel().setText(renaming != null ? "$text.server.edit" : "$text.server.add");
|
add.getTitleLabel().setText(renaming != null ? "$text.server.edit" : "$text.server.add");
|
||||||
field.setText(renaming.ip);
|
if(renaming != null){
|
||||||
|
field.setText(renaming.ip);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
shown(() -> {
|
shown(() -> {
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean shouldDistribute(Tile tile, Tile other){
|
protected boolean shouldDistribute(Tile tile, Tile other){
|
||||||
return other.getTeamID() == tile.getTeamID() && other.entity.power.amount / other.block().powerCapacity <= tile.entity.power.amount / powerCapacity &&
|
return other != null && other.getTeamID() == tile.getTeamID() && other.entity.power.amount / other.block().powerCapacity <= tile.entity.power.amount / powerCapacity &&
|
||||||
!(other.block() instanceof PowerGenerator); //do not distribute to power generators
|
!(other.block() instanceof PowerGenerator); //do not distribute to power generators
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user