Crash fixes

This commit is contained in:
Anuken 2018-09-03 09:02:16 -04:00
parent 3b63f60462
commit 5129e2ea73
9 changed files with 10 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 99 KiB

View File

@ -272,7 +272,7 @@ public class Control extends Module{
for(int i = 0; i < Recipe.all().size; 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)){
ui.hudfrag.showUnlock(recipe);
}

View File

@ -217,7 +217,7 @@ public class NetClient extends Module{
int totalChunks = Mathf.ceil((float) totalLength / NetServer.maxSnapshotSize);
//reset status when a new snapshot sending begins
if(netClient.currentSnapshotID != snapshotID){
if(netClient.currentSnapshotID != snapshotID || netClient.recievedChunks == null){
netClient.currentSnapshotID = snapshotID;
netClient.currentSnapshot = new byte[totalLength];
netClient.recievedChunkCounter = 0;

View File

@ -146,7 +146,8 @@ public class HudFragment extends Fragment{
});
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;
return false;
}

View File

@ -53,6 +53,7 @@ public class BuildBlock extends Block{
@Remote(called = Loc.server)
public static void onConstructFinish(Tile tile, Block block, int builderID, byte rotation, Team team){
if(tile == null) return;
tile.setRotation(rotation);
world.setBlock(tile, block, team);
Effects.effect(Fx.placeBlock, tile.drawx(), tile.drawy(), block.size);

View File

@ -61,6 +61,7 @@ public class ItemTurret extends CooledTurret{
@Override
public void handleItem(Item item, Tile tile, Tile source){
TurretEntity entity = tile.entity();
if(entity == null) return;
AmmoType type = ammoMap.get(item);
entity.totalAmmo += type.quantityMultiplier;

View File

@ -264,7 +264,7 @@ public class MassDriver extends Block{
//whether this mass driver is waiting for a bullet to hit it and deliver items
public boolean isRecieving;
//whether this driver just recieved some items and is now unloading
public boolean isUnloading;
public boolean isUnloading = true;
public float reload = 0f;

View File

@ -79,7 +79,7 @@ public class CoreBlock extends StorageBlock{
@Remote(called = Loc.server)
public static void setCoreSolid(Tile tile, boolean solid){
CoreEntity entity = tile.entity();
entity.solid = solid;
if(entity != null) entity.solid = solid;
}
@Override

View File

@ -27,11 +27,13 @@ public class ConsumePower extends Consume{
@Override
public void update(Block block, TileEntity entity){
if(entity.power == null) return;
entity.power.amount -= Math.min(use(block), entity.power.amount);
}
@Override
public boolean valid(Block block, TileEntity entity){
if(entity.power == null) return false;
return entity.power.amount >= use(block);
}