Fixes some possible NPE locations

This commit is contained in:
modmuss50 2019-02-01 13:42:21 +00:00
parent a5fa237017
commit 72a09d2368
3 changed files with 13 additions and 16 deletions

View file

@ -57,6 +57,9 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
}
public boolean getMutliBlock() {
if(multiblockChecker == null){
return false;
}
final boolean down = multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
final boolean up = multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 2, 0));
final boolean chamber = multiblockChecker.checkRingYHollow(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 1, 0));
@ -67,8 +70,7 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
@Override
public void update() {
if (multiblockChecker == null) {
final BlockPos downCenter = pos.offset(getFacing().getOpposite(), 2);
multiblockChecker = new MultiblockChecker(world, downCenter);
multiblockChecker = new MultiblockChecker(world, pos.down(3));
}
if (!world.isRemote && getMutliBlock()){
@ -76,13 +78,6 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
}
}
// TileEntity
@Override
public void validate() {
super.validate();
multiblockChecker = new MultiblockChecker(world, pos.down(3));
}
// IContainerProvider
@Override
public BuiltContainer createContainer(final EntityPlayer player) {

View file

@ -107,6 +107,9 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
}
public boolean getMutliBlock() {
if(multiblockChecker == null){
return false;
}
final boolean layer0 = multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_ANY, MultiblockChecker.ZERO_OFFSET);
final boolean layer1 = multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 1, 0));
final boolean layer2 = multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 2, 0));

View file

@ -56,24 +56,23 @@ public class TileVacuumFreezer extends TileGenericMachine implements IContainerP
}
public boolean getMultiBlock() {
if(multiblockChecker == null){
return false;
}
return multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
}
// TileGenericMachine
@Override
public void update() {
if(multiblockChecker == null){
multiblockChecker = new MultiblockChecker(world, pos.down());
}
if (!world.isRemote && getMultiBlock()) {
super.update();
}
}
// TileEntity
@Override
public void validate() {
super.validate();
multiblockChecker = new MultiblockChecker(world, pos.down());
}
// IContainerProvider
@Override
public BuiltContainer createContainer(final EntityPlayer player) {