aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
diff options
context:
space:
mode:
authorJakub <53441451+kuba6000@users.noreply.github.com>2022-08-29 16:04:28 +0200
committerGitHub <noreply@github.com>2022-08-29 16:04:28 +0200
commit7d1f51a8937e0a86486267437d444696e81e8aa0 (patch)
treea5b145e7271998f7b4b968a2212ed487e54a92b5 /src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
parent5267969156d30b4bb5f4cb2279ebb49db6bd40e2 (diff)
downloadGT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.gz
GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.bz2
GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.zip
Buildscript + Spotless (#318)
* Convert AES.java to readable class * Buildscript * Spotless
Diffstat (limited to 'src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java')
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java353
1 files changed, 175 insertions, 178 deletions
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java b/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
index 0b8f97b378..f7d29e1200 100644
--- a/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
+++ b/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
@@ -1,6 +1,5 @@
package gtPlusPlus.api.objects.minecraft;
-import gtPlusPlus.core.util.minecraft.FluidUtils;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
@@ -8,181 +7,179 @@ import net.minecraftforge.fluids.FluidTankInfo;
public class BTF_FluidTank extends FluidTank {
- public FluidStack mFluid;
-
- public BTF_FluidTank(int capacity) {
- super(capacity);
- }
-
- /**
- * Let's replace the Default handling with GT's own handling code, because it's probably better, right?
- * @author Alkalus/GregoriusT
- */
-
-
- public FluidStack getFluid() {
- return this.getDrainableStack();
- }
-
- public int getFluidAmount() {
- return this.getDrainableStack() != null ? this.getDrainableStack().amount : 0;
- }
-
- public NBTTagCompound writeToNBT(NBTTagCompound aNBT) {
- super.writeToNBT(aNBT);
- if (this.mFluid != null) {
- aNBT.setTag("mFluid", this.mFluid.writeToNBT(new NBTTagCompound()));
- }
- return aNBT;
- }
-
- public FluidTank readFromNBT(NBTTagCompound aNBT) {
- this.mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- return this;
- }
-
-/* public abstract boolean isLiquidInput(byte arg0);
-
- public abstract boolean isLiquidOutput(byte arg0);
-
- public abstract boolean doesFillContainers();
-
- public abstract boolean doesEmptyContainers();*/
-
- public boolean canTankBeFilled() {
- return true;
- }
-
- public boolean canTankBeEmptied() {
- return true;
- }
-
-
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return true;
- }
-
- public FluidStack getFillableStack() {
- return this.mFluid;
- }
-
- public FluidStack setFillableStack(FluidStack aFluid) {
- this.mFluid = aFluid;
- return this.mFluid;
- }
-
- public FluidStack getDrainableStack() {
- return this.mFluid;
- }
-
- public FluidStack setDrainableStack(FluidStack aFluid) {
- this.mFluid = aFluid;
- return this.mFluid;
- }
-
- public FluidStack getDisplayedFluid() {
- return this.getDrainableStack();
- }
-
- public boolean isFluidChangingAllowed() {
- return true;
- }
-
- public int fill(FluidStack aFluid, boolean doFill) {
- if (aFluid != null && aFluid.getFluid().getID() > 0 && aFluid.amount > 0 && this.canTankBeFilled()
- && this.isFluidInputAllowed(aFluid)) {
- if (this.getFillableStack() != null && this.getFillableStack().getFluid().getID() > 0) {
- if (!this.getFillableStack().isFluidEqual(aFluid)) {
- return 0;
- } else {
- int space = this.getCapacity() - this.getFillableStack().amount;
- if (aFluid.amount <= space) {
- if (doFill) {
- FluidStack arg9999 = this.getFillableStack();
- arg9999.amount += aFluid.amount;
- }
-
- return aFluid.amount;
- } else {
- if (doFill) {
- this.getFillableStack().amount = this.getCapacity();
- }
-
- return space;
- }
- }
- } else if (aFluid.amount <= this.getCapacity()) {
- if (doFill) {
- this.setFillableStack(aFluid.copy());
- }
-
- return aFluid.amount;
- } else {
- if (doFill) {
- this.setFillableStack(aFluid.copy());
- this.getFillableStack().amount = this.getCapacity();
- }
-
- return this.getCapacity();
- }
- } else {
- return 0;
- }
- }
-
- public FluidStack drain(int maxDrain, boolean doDrain) {
- if (this.getDrainableStack() != null && this.canTankBeEmptied()) {
- if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
- this.setDrainableStack((FluidStack) null);
- return null;
- } else {
- int used = maxDrain;
- if (this.getDrainableStack().amount < maxDrain) {
- used = this.getDrainableStack().amount;
- }
-
- if (doDrain) {
- FluidStack arg9999 = this.getDrainableStack();
- arg9999.amount -= used;
- }
-
- FluidStack drained = this.getDrainableStack().copy();
- drained.amount = used;
- if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
- this.setDrainableStack((FluidStack) null);
- }
-
- return drained;
- }
- } else {
- return null;
- }
- }
-
- @Override
- public int getCapacity() {
- return super.getCapacity();
- }
-
- @Override
- public FluidTankInfo getInfo() {
- return new FluidTankInfo(this);
- }
-
- @Override
- public void setFluid(FluidStack fluid) {
- setFillableStack(fluid);
- }
-
- @Override
- public void setCapacity(int capacity) {
- super.setCapacity(capacity);
- }
-
- public FluidStack drain(FluidStack aFluid, boolean doDrain) {
- return drain(aFluid.amount, doDrain);
- }
-
-
-
+ public FluidStack mFluid;
+
+ public BTF_FluidTank(int capacity) {
+ super(capacity);
+ }
+
+ /**
+ * Let's replace the Default handling with GT's own handling code, because it's probably better, right?
+ * @author Alkalus/GregoriusT
+ */
+ public FluidStack getFluid() {
+ return this.getDrainableStack();
+ }
+
+ public int getFluidAmount() {
+ return this.getDrainableStack() != null ? this.getDrainableStack().amount : 0;
+ }
+
+ public NBTTagCompound writeToNBT(NBTTagCompound aNBT) {
+ super.writeToNBT(aNBT);
+ if (this.mFluid != null) {
+ aNBT.setTag("mFluid", this.mFluid.writeToNBT(new NBTTagCompound()));
+ }
+ return aNBT;
+ }
+
+ public FluidTank readFromNBT(NBTTagCompound aNBT) {
+ this.mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
+ return this;
+ }
+
+ /* public abstract boolean isLiquidInput(byte arg0);
+
+ public abstract boolean isLiquidOutput(byte arg0);
+
+ public abstract boolean doesFillContainers();
+
+ public abstract boolean doesEmptyContainers();*/
+
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return true;
+ }
+
+ public FluidStack getFillableStack() {
+ return this.mFluid;
+ }
+
+ public FluidStack setFillableStack(FluidStack aFluid) {
+ this.mFluid = aFluid;
+ return this.mFluid;
+ }
+
+ public FluidStack getDrainableStack() {
+ return this.mFluid;
+ }
+
+ public FluidStack setDrainableStack(FluidStack aFluid) {
+ this.mFluid = aFluid;
+ return this.mFluid;
+ }
+
+ public FluidStack getDisplayedFluid() {
+ return this.getDrainableStack();
+ }
+
+ public boolean isFluidChangingAllowed() {
+ return true;
+ }
+
+ public int fill(FluidStack aFluid, boolean doFill) {
+ if (aFluid != null
+ && aFluid.getFluid().getID() > 0
+ && aFluid.amount > 0
+ && this.canTankBeFilled()
+ && this.isFluidInputAllowed(aFluid)) {
+ if (this.getFillableStack() != null
+ && this.getFillableStack().getFluid().getID() > 0) {
+ if (!this.getFillableStack().isFluidEqual(aFluid)) {
+ return 0;
+ } else {
+ int space = this.getCapacity() - this.getFillableStack().amount;
+ if (aFluid.amount <= space) {
+ if (doFill) {
+ FluidStack arg9999 = this.getFillableStack();
+ arg9999.amount += aFluid.amount;
+ }
+
+ return aFluid.amount;
+ } else {
+ if (doFill) {
+ this.getFillableStack().amount = this.getCapacity();
+ }
+
+ return space;
+ }
+ }
+ } else if (aFluid.amount <= this.getCapacity()) {
+ if (doFill) {
+ this.setFillableStack(aFluid.copy());
+ }
+
+ return aFluid.amount;
+ } else {
+ if (doFill) {
+ this.setFillableStack(aFluid.copy());
+ this.getFillableStack().amount = this.getCapacity();
+ }
+
+ return this.getCapacity();
+ }
+ } else {
+ return 0;
+ }
+ }
+
+ public FluidStack drain(int maxDrain, boolean doDrain) {
+ if (this.getDrainableStack() != null && this.canTankBeEmptied()) {
+ if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
+ this.setDrainableStack((FluidStack) null);
+ return null;
+ } else {
+ int used = maxDrain;
+ if (this.getDrainableStack().amount < maxDrain) {
+ used = this.getDrainableStack().amount;
+ }
+
+ if (doDrain) {
+ FluidStack arg9999 = this.getDrainableStack();
+ arg9999.amount -= used;
+ }
+
+ FluidStack drained = this.getDrainableStack().copy();
+ drained.amount = used;
+ if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
+ this.setDrainableStack((FluidStack) null);
+ }
+
+ return drained;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public int getCapacity() {
+ return super.getCapacity();
+ }
+
+ @Override
+ public FluidTankInfo getInfo() {
+ return new FluidTankInfo(this);
+ }
+
+ @Override
+ public void setFluid(FluidStack fluid) {
+ setFillableStack(fluid);
+ }
+
+ @Override
+ public void setCapacity(int capacity) {
+ super.setCapacity(capacity);
+ }
+
+ public FluidStack drain(FluidStack aFluid, boolean doDrain) {
+ return drain(aFluid.amount, doDrain);
+ }
}