Fixed crash with core capture
This commit is contained in:
@@ -225,7 +225,7 @@ public class BlockIndexer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(drop != null && ores != null && ores[drop.id] != null&& ores[drop.id][qx][qy] != null && ores[drop.id][qx][qy].removeValue(pos)){ //floor
|
if(drop != null && ores != null && ores[drop.id] != null && ores[drop.id][qx][qy] != null && ores[drop.id][qx][qy].removeValue(pos)){ //floor
|
||||||
int old = allOres.increment(drop, -1);
|
int old = allOres.increment(drop, -1);
|
||||||
if(old == 1) updatePresentOres();
|
if(old == 1) updatePresentOres();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -618,15 +618,19 @@ public class CoreBlock extends StorageBlock{
|
|||||||
if(state.rules.coreCapture){
|
if(state.rules.coreCapture){
|
||||||
if(!net.client()){
|
if(!net.client()){
|
||||||
tile.setBlock(block, lastDamage);
|
tile.setBlock(block, lastDamage);
|
||||||
}
|
|
||||||
|
|
||||||
//delay so clients don't destroy it afterwards
|
|
||||||
Core.app.post(() -> tile.setNet(block, lastDamage, 0));
|
|
||||||
|
|
||||||
//building does not exist on client yet
|
|
||||||
if(!net.client()){
|
|
||||||
//core is invincible for several seconds to prevent recapture
|
//core is invincible for several seconds to prevent recapture
|
||||||
((CoreBuild)tile.build).iframes = captureInvicibility;
|
((CoreBuild)tile.build).iframes = captureInvicibility;
|
||||||
|
|
||||||
|
if(net.server()){
|
||||||
|
//delay so clients don't destroy it afterwards
|
||||||
|
Core.app.post(() -> {
|
||||||
|
//make sure the world hasn't reloaded since
|
||||||
|
if(world.tile(tile.x, tile.y) == tile){
|
||||||
|
tile.setNet(block, lastDamage, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user