Skip to content

Commit

Permalink
Fix stabilizer block check for Node Linker.
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdielKavash committed Apr 22, 2024
1 parent 95357da commit 798549a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
25 changes: 16 additions & 9 deletions src/main/java/tb/common/tile/TileNodeLinker.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -152,23 +153,29 @@ public void updateEntity() {
} else instability = 0;
}

private static final Block STABILIZER_BLOCK = OreDictionary.doesOreNameExist("blockIchorium")
&& !OreDictionary.getOres("blockIchorium")
.isEmpty() ? Block.getBlockFromItem(
OreDictionary.getOres("blockIchorium")
.get(0)
.getItem())
: null;

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))))))
instability -= explodeTransmitter();
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))))))
instability -= harmTransmitter();
if (!hasStabilizerBlock()) instability -= harmTransmitter();
} else {
if (rnd >= 31) {
instability -= wisp();
Expand Down

0 comments on commit 798549a

Please sign in to comment.