mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Crash fixes
This commit is contained in:
parent
3b63f60462
commit
5129e2ea73
Binary file not shown.
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
@ -272,7 +272,7 @@ public class Control extends Module{
|
|||||||
|
|
||||||
for(int i = 0; i < Recipe.all().size; i++){
|
for(int i = 0; i < Recipe.all().size; i++){
|
||||||
Recipe recipe = Recipe.all().get(i);
|
Recipe recipe = Recipe.all().get(i);
|
||||||
if(!recipe.debugOnly && entity.items.has(recipe.requirements, 1.4f)){
|
if(!recipe.debugOnly && recipe.requirements != null && entity.items.has(recipe.requirements, 1.4f)){
|
||||||
if(control.database().unlockContent(recipe)){
|
if(control.database().unlockContent(recipe)){
|
||||||
ui.hudfrag.showUnlock(recipe);
|
ui.hudfrag.showUnlock(recipe);
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ public class NetClient extends Module{
|
|||||||
int totalChunks = Mathf.ceil((float) totalLength / NetServer.maxSnapshotSize);
|
int totalChunks = Mathf.ceil((float) totalLength / NetServer.maxSnapshotSize);
|
||||||
|
|
||||||
//reset status when a new snapshot sending begins
|
//reset status when a new snapshot sending begins
|
||||||
if(netClient.currentSnapshotID != snapshotID){
|
if(netClient.currentSnapshotID != snapshotID || netClient.recievedChunks == null){
|
||||||
netClient.currentSnapshotID = snapshotID;
|
netClient.currentSnapshotID = snapshotID;
|
||||||
netClient.currentSnapshot = new byte[totalLength];
|
netClient.currentSnapshot = new byte[totalLength];
|
||||||
netClient.recievedChunkCounter = 0;
|
netClient.recievedChunkCounter = 0;
|
||||||
|
@ -146,7 +146,8 @@ public class HudFragment extends Fragment{
|
|||||||
});
|
});
|
||||||
|
|
||||||
t.top().visible(() -> {
|
t.top().visible(() -> {
|
||||||
if(state.is(State.menu) || state.teams.get(players[0].getTeam()).cores.size == 0){
|
if(state.is(State.menu) || state.teams.get(players[0].getTeam()).cores.size == 0 ||
|
||||||
|
state.teams.get(players[0].getTeam()).cores.first().entity == null){
|
||||||
coreAttackTime = 0f;
|
coreAttackTime = 0f;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ public class BuildBlock extends Block{
|
|||||||
|
|
||||||
@Remote(called = Loc.server)
|
@Remote(called = Loc.server)
|
||||||
public static void onConstructFinish(Tile tile, Block block, int builderID, byte rotation, Team team){
|
public static void onConstructFinish(Tile tile, Block block, int builderID, byte rotation, Team team){
|
||||||
|
if(tile == null) return;
|
||||||
tile.setRotation(rotation);
|
tile.setRotation(rotation);
|
||||||
world.setBlock(tile, block, team);
|
world.setBlock(tile, block, team);
|
||||||
Effects.effect(Fx.placeBlock, tile.drawx(), tile.drawy(), block.size);
|
Effects.effect(Fx.placeBlock, tile.drawx(), tile.drawy(), block.size);
|
||||||
|
@ -61,6 +61,7 @@ public class ItemTurret extends CooledTurret{
|
|||||||
@Override
|
@Override
|
||||||
public void handleItem(Item item, Tile tile, Tile source){
|
public void handleItem(Item item, Tile tile, Tile source){
|
||||||
TurretEntity entity = tile.entity();
|
TurretEntity entity = tile.entity();
|
||||||
|
if(entity == null) return;
|
||||||
|
|
||||||
AmmoType type = ammoMap.get(item);
|
AmmoType type = ammoMap.get(item);
|
||||||
entity.totalAmmo += type.quantityMultiplier;
|
entity.totalAmmo += type.quantityMultiplier;
|
||||||
|
@ -264,7 +264,7 @@ public class MassDriver extends Block{
|
|||||||
//whether this mass driver is waiting for a bullet to hit it and deliver items
|
//whether this mass driver is waiting for a bullet to hit it and deliver items
|
||||||
public boolean isRecieving;
|
public boolean isRecieving;
|
||||||
//whether this driver just recieved some items and is now unloading
|
//whether this driver just recieved some items and is now unloading
|
||||||
public boolean isUnloading;
|
public boolean isUnloading = true;
|
||||||
|
|
||||||
public float reload = 0f;
|
public float reload = 0f;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class CoreBlock extends StorageBlock{
|
|||||||
@Remote(called = Loc.server)
|
@Remote(called = Loc.server)
|
||||||
public static void setCoreSolid(Tile tile, boolean solid){
|
public static void setCoreSolid(Tile tile, boolean solid){
|
||||||
CoreEntity entity = tile.entity();
|
CoreEntity entity = tile.entity();
|
||||||
entity.solid = solid;
|
if(entity != null) entity.solid = solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,11 +27,13 @@ public class ConsumePower extends Consume{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Block block, TileEntity entity){
|
public void update(Block block, TileEntity entity){
|
||||||
|
if(entity.power == null) return;
|
||||||
entity.power.amount -= Math.min(use(block), entity.power.amount);
|
entity.power.amount -= Math.min(use(block), entity.power.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean valid(Block block, TileEntity entity){
|
public boolean valid(Block block, TileEntity entity){
|
||||||
|
if(entity.power == null) return false;
|
||||||
return entity.power.amount >= use(block);
|
return entity.power.amount >= use(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user