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 GTC_AdvFluidDetectorBound #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCov
if ((aTileEntity instanceof IFluidHandler)) {
int tMax = 0;
int tUsed = 0;
FluidTankInfo tTank = ((IFluidHandler) aTileEntity).getTankInfo(ForgeDirection.UNKNOWN)[0];
if (tTank != null) {
tMax = tTank.capacity;
FluidStack tLiquid = tTank.fluid;
if (tLiquid != null) {
tUsed = tLiquid.amount;
FluidTankInfo[] tTanks = ((IFluidHandler) aTileEntity).getTankInfo(ForgeDirection.UNKNOWN);
if (tTanks != null) {
for (FluidTankInfo tTank : tTanks) {
if (tTank != null) {
tMax = tTank.capacity;
FluidStack tLiquid = tTank.fluid;
if (tLiquid != null) {
tUsed = tLiquid.amount;
}
}
}
}
if (tMax < aCoverVariable) {
Expand Down Expand Up @@ -130,9 +134,13 @@ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity)
fBox.setMaxStringLength(12);
this.pBox = new GT_GuiIntegerTextBox(this, 2, startX, startY + spaceY + 2, spaceX * 4 - 3, 12);
if ((aTileEntity instanceof IFluidHandler)) {
FluidTankInfo tTank = ((IFluidHandler) aTileEntity).getTankInfo(ForgeDirection.UNKNOWN)[0];
if (tTank != null) {
maxCapacity = tTank.capacity;
FluidTankInfo[] tTanks = ((IFluidHandler) aTileEntity).getTankInfo(ForgeDirection.UNKNOWN);
if (tTanks != null) {
for (FluidTankInfo tTank : tTanks) {
if (tTank != null) {
maxCapacity = tTank.capacity;
}
}
}
}
percent = (int) ((double) coverVariable / (double) maxCapacity * 100d);
Expand Down Expand Up @@ -210,4 +218,4 @@ public void resetTextBox(GT_GuiIntegerTextBox box) {
box.setText(String.valueOf(coverVariable));
}
}
}
}