Fixed crash with core capture

This commit is contained in:
Anuken
2025-04-24 11:06:48 -04:00
parent 6f4bcbf933
commit b46139d723
2 changed files with 11 additions and 7 deletions

View File

@@ -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);
if(old == 1) updatePresentOres();
}

View File

@@ -618,15 +618,19 @@ public class CoreBlock extends StorageBlock{
if(state.rules.coreCapture){
if(!net.client()){
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
((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);
}
});
}
}
}
}