aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2022-08-23 12:36:21 +0800
committerGitHub <noreply@github.com>2022-08-23 05:36:21 +0100
commit61bf7cd2215e844aff5f18837499cf0d40bc2a41 (patch)
tree8a4a44524cb4bff75f478e2c0f28c4ce77eb9cda /src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations
parent2663d6169157c329f079f42a6f4a8c17f52cbba5 (diff)
downloadGT5-Unofficial-61bf7cd2215e844aff5f18837499cf0d40bc2a41.tar.gz
GT5-Unofficial-61bf7cd2215e844aff5f18837499cf0d40bc2a41.tar.bz2
GT5-Unofficial-61bf7cd2215e844aff5f18837499cf0d40bc2a41.zip
fix a bunch of structure code error (#294)
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index da38f14758..0e5027fc09 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -1622,7 +1622,28 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
return null;
}
- @Override
+ /**
+ * Deplete fluid input from a set of restricted hatches. This assumes these hatches can store nothing else but your
+ * expected fluid
+ */
+ protected boolean depleteInputFromRestrictedHatches(Collection<GT_MetaTileEntity_Hatch_CustomFluidBase> aHatches, int aAmount) {
+ for (final GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : aHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ FluidStack tLiquid = tHatch.getFluid();
+ if (tLiquid == null || tLiquid.amount < aAmount) {
+ continue;
+ }
+ tLiquid = tHatch.drain(aAmount, false);
+ if (tLiquid != null && tLiquid.amount >= aAmount) {
+ tLiquid = tHatch.drain(aAmount, true);
+ return tLiquid != null && tLiquid.amount >= aAmount;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
public void updateSlots() {
for (final GT_MetaTileEntity_Hatch_InputBattery tHatch : this.mChargeHatches) {
if (isValidMetaTileEntity(tHatch)) {