Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stabilizer block check for Node Linker. #32

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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