diff options
author | chill <chill.gtnh@outlook.com> | 2023-05-27 17:41:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-27 17:41:53 +0200 |
commit | b510ec5baafd4ff69bac158631fc4e4ca93b342d (patch) | |
tree | ed356f5d63e2b4c1b384dc4ed6dbda6ff7a35246 /src/main/java/gregtech/api/metatileentity/implementations | |
parent | d0e291fa8cb31cedcf9ef8fbafb536f19b216907 (diff) | |
download | GT5-Unofficial-b510ec5baafd4ff69bac158631fc4e4ca93b342d.tar.gz GT5-Unofficial-b510ec5baafd4ff69bac158631fc4e4ca93b342d.tar.bz2 GT5-Unofficial-b510ec5baafd4ff69bac158631fc4e4ca93b342d.zip |
Refactor checkExoticAndNormalEnergyHatches (#2025)
* add tests to checkExoticAndNormalEnergyHatches
Add a parameterized test to
GT_MetaTileEntity_MultiBlockBase::checkExoticAndNormalEnergyHatches
in order to be sure that the function returns the same results after
the change.
* refactor checkExoticAndNormalEnergyHatches
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity/implementations')
-rw-r--r-- | src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 7eacf05b4e..af0219c4b1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -25,6 +25,7 @@ import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.TestOnly; import org.lwjgl.input.Keyboard; import com.google.common.collect.Iterables; @@ -96,7 +97,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<>(); public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<>(); public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<>(); - protected final List<GT_MetaTileEntity_Hatch> mExoticEnergyHatches = new ArrayList<>(); + protected List<GT_MetaTileEntity_Hatch> mExoticEnergyHatches = new ArrayList<>(); @SideOnly(Side.CLIENT) protected GT_SoundLoop activitySoundLoop; @@ -1505,7 +1506,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity return false; } - if (mExoticEnergyHatches.size() >= 1) { + if (!mExoticEnergyHatches.isEmpty()) { if (!mEnergyHatches.isEmpty()) { return false; } @@ -1515,11 +1516,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } } - if (mEnergyHatches.size() > 2) { - return false; - } - - return true; + return mEnergyHatches.size() <= 2; } /** @@ -1917,4 +1914,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity .setTooltipShowUpDelay(TOOLTIP_DELAY); return (ButtonWidget) button; } + + @TestOnly + protected void setEnergyHatches(ArrayList<GT_MetaTileEntity_Hatch_Energy> EnergyHatches) { + this.mEnergyHatches = EnergyHatches; + } + + @TestOnly + protected void setExoticEnergyHatches(List<GT_MetaTileEntity_Hatch> ExoticEnergyHatches) { + this.mExoticEnergyHatches = ExoticEnergyHatches; + } } |