Fixes some possible NPE locations
This commit is contained in:
parent
a5fa237017
commit
72a09d2368
3 changed files with 13 additions and 16 deletions
|
@ -57,6 +57,9 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getMutliBlock() {
|
public boolean getMutliBlock() {
|
||||||
|
if(multiblockChecker == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
final boolean down = multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
|
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 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));
|
final boolean chamber = multiblockChecker.checkRingYHollow(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 1, 0));
|
||||||
|
@ -67,21 +70,13 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
if (multiblockChecker == null) {
|
if (multiblockChecker == null) {
|
||||||
final BlockPos downCenter = pos.offset(getFacing().getOpposite(), 2);
|
multiblockChecker = new MultiblockChecker(world, pos.down(3));
|
||||||
multiblockChecker = new MultiblockChecker(world, downCenter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!world.isRemote && getMutliBlock()){
|
if (!world.isRemote && getMutliBlock()){
|
||||||
super.update();
|
super.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TileEntity
|
|
||||||
@Override
|
|
||||||
public void validate() {
|
|
||||||
super.validate();
|
|
||||||
multiblockChecker = new MultiblockChecker(world, pos.down(3));
|
|
||||||
}
|
|
||||||
|
|
||||||
// IContainerProvider
|
// IContainerProvider
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -107,6 +107,9 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getMutliBlock() {
|
public boolean getMutliBlock() {
|
||||||
|
if(multiblockChecker == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
final boolean layer0 = multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_ANY, MultiblockChecker.ZERO_OFFSET);
|
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 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));
|
final boolean layer2 = multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 2, 0));
|
||||||
|
|
|
@ -56,24 +56,23 @@ public class TileVacuumFreezer extends TileGenericMachine implements IContainerP
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getMultiBlock() {
|
public boolean getMultiBlock() {
|
||||||
|
if(multiblockChecker == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
|
return multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TileGenericMachine
|
// TileGenericMachine
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
|
if(multiblockChecker == null){
|
||||||
|
multiblockChecker = new MultiblockChecker(world, pos.down());
|
||||||
|
}
|
||||||
if (!world.isRemote && getMultiBlock()) {
|
if (!world.isRemote && getMultiBlock()) {
|
||||||
super.update();
|
super.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TileEntity
|
|
||||||
@Override
|
|
||||||
public void validate() {
|
|
||||||
super.validate();
|
|
||||||
multiblockChecker = new MultiblockChecker(world, pos.down());
|
|
||||||
}
|
|
||||||
|
|
||||||
// IContainerProvider
|
// IContainerProvider
|
||||||
@Override
|
@Override
|
||||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||||
|
|
Loading…
Reference in a new issue