diff --git a/dependencies.gradle b/dependencies.gradle index a15f19d..5bf7943 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.148:dev') {transitive=false} + compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.155:dev') {transitive=false} compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') compile('com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev') diff --git a/src/main/java/tb/common/tile/TileNodeLinker.java b/src/main/java/tb/common/tile/TileNodeLinker.java index 0e11d2f..f1cbe6e 100644 --- a/src/main/java/tb/common/tile/TileNodeLinker.java +++ b/src/main/java/tb/common/tile/TileNodeLinker.java @@ -4,6 +4,7 @@ import java.util.Collection; import java.util.List; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -152,23 +153,33 @@ public void updateEntity() { } else instability = 0; } + // Spotless messes this initialization up very badly. It is much clearer to read this way. + // spotless:off + private static final Block STABILIZER_BLOCK = + OreDictionary.doesOreNameExist("blockIchorium") && !OreDictionary.getOres("blockIchorium").isEmpty() + ? Block.getBlockFromItem(OreDictionary.getOres("blockIchorium").get(0).getItem()) + : null; + // spotless:on + + private boolean hasStabilizerBlock() { + return STABILIZER_BLOCK != null + && this.worldObj.getBlock(this.xCoord, this.yCoord + 1, this.zCoord) == STABILIZER_BLOCK; + } + public boolean instabilityCheck() { if (this.worldObj.rand.nextInt(50) <= this.instability) { int rnd = this.worldObj.rand.nextInt(this.instability); if (rnd == 49) { // if a block of Ichorium is above dont explode or harm node - if (!OreDictionary.doesOreNameExist("blockIchorium") - || (OreDictionary.getOres("blockIchorium") != null && !(OreDictionary.getOres("blockIchorium") - .contains(new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord + 1, this.zCoord)))))) + if (!hasStabilizerBlock()) { instability -= explodeTransmitter(); + } } else { if (rnd >= 45) { // if a block of Ichorium is above dont explode or harm node - if (!OreDictionary.doesOreNameExist("blockIchorium") - || (OreDictionary.getOres("blockIchorium") != null && !(OreDictionary.getOres("blockIchorium") - .contains( - new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord + 1, this.zCoord)))))) + if (!hasStabilizerBlock()) { instability -= harmTransmitter(); + } } else { if (rnd >= 31) { instability -= wisp();