From 55f64675b42ac8d3c557cc850f78664bee006f6f Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 28 Jan 2023 19:32:44 -0800 Subject: [ci skip] spotlessApply with the new settings --- .../GT_MetaTileEntity_BasicBreaker.java | 104 +- ...GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java | 67 +- .../GT_MetaTileEntity_Dehydrator.java | 78 +- .../GT_MetaTileEntity_DeluxeMachine.java | 320 ++--- .../GT_MetaTileEntity_DeluxeTank.java | 108 +- .../GT_MetaTileEntity_Hatch_AirIntake.java | 18 +- .../GT_MetaTileEntity_Hatch_AirIntake_Extreme.java | 8 +- .../GT_MetaTileEntity_Hatch_ControlCore.java | 48 +- .../GT_MetaTileEntity_Hatch_DynamoBuffer.java | 49 +- ...etaTileEntity_Hatch_ElementalDataOrbHolder.java | 66 +- .../GT_MetaTileEntity_Hatch_Energy_RTG.java | 52 +- .../GT_MetaTileEntity_Hatch_FluidGenerator.java | 56 +- .../GT_MetaTileEntity_Hatch_InputBattery.java | 46 +- .../GT_MetaTileEntity_Hatch_Muffler_Adv.java | 52 +- .../GT_MetaTileEntity_Hatch_Naquadah.java | 78 +- .../GT_MetaTileEntity_Hatch_OutputBattery.java | 46 +- .../GT_MetaTileEntity_Hatch_Plasma.java | 77 +- .../GT_MetaTileEntity_Hatch_Reservoir.java | 44 +- .../GT_MetaTileEntity_Hatch_Steam_BusInput.java | 186 ++- .../GT_MetaTileEntity_Hatch_Steam_BusOutput.java | 159 +-- .../GT_MetaTileEntity_Hatch_Turbine.java | 68 +- .../GT_MetaTileEntity_Hatch_TurbineProvider.java | 42 +- .../GT_MetaTileEntity_SuperBus_Input.java | 15 +- .../GT_MetaTileEntity_SuperBus_Output.java | 24 +- .../GregtechMetaPipeEntityFluid.java | 164 +-- .../GregtechMetaPipeEntity_Cable.java | 260 ++-- .../GregtechMetaTreeFarmerStructural.java | 32 +- .../implementations/base/CustomMetaTileBase.java | 38 +- .../GT_MetaTileEntity_Hatch_CustomFluidBase.java | 66 +- .../base/GregtechMetaPipeEntityBase_Cable.java | 342 +++-- .../base/GregtechMetaTileEntity.java | 28 +- .../base/GregtechMetaTransformerHiAmp.java | 76 +- .../base/GregtechMeta_MultiBlockBase.java | 1311 ++++++++++---------- .../base/GregtechMeta_SteamMultiBase.java | 139 +-- .../GregtechDoubleFuelGeneratorBase.java | 227 ++-- .../base/generators/GregtechMetaBoilerBase.java | 180 ++- .../generators/GregtechMetaSolarGenerator.java | 70 +- .../GregtechRocketFuelGeneratorBase.java | 164 +-- .../base/machines/GregtechMetaSafeBlockBase.java | 126 +- .../base/machines/GregtechMetaTreeFarmerBase.java | 61 +- .../GT_MetaTileEntity_Hatch_Catalysts.java | 9 +- .../GT_MetaTileEntity_Hatch_MillingBalls.java | 9 +- .../GT_MetaTileEntity_Hatch_NbtConsumable.java | 145 +-- 43 files changed, 2347 insertions(+), 2911 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java index b9ffc8740a..8d8ec9b1be 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java @@ -1,7 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.gui.modularui.GT_UIInfos; @@ -15,10 +21,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_TieredMachineBlock; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock implements IAddUIWidgets { @@ -30,18 +32,18 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock private long mStored = 0L; private long mMax = 0L; - public GT_MetaTileEntity_BasicBreaker( - int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) { + public GT_MetaTileEntity_BasicBreaker(int aID, String aName, String aNameRegional, int aTier, String aDescription, + int aSlotCount) { super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription, new ITexture[0]); } - public GT_MetaTileEntity_BasicBreaker( - String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) { + public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, + int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_BasicBreaker( - String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aSlotCount) { + public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, + int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } @@ -49,13 +51,21 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock final String[] desc = new String[6]; int tTier = this.mTier; desc[0] = "" + EnumChatFormatting.BOLD + "16 Fuse Slots"; - desc[1] = "Per each fuse, you may insert " + EnumChatFormatting.YELLOW + (GT_Values.V[tTier]) - + EnumChatFormatting.GRAY + " EU/t"; - desc[2] = "However this " + EnumChatFormatting.ITALIC + EnumChatFormatting.RED + "MUST" - + EnumChatFormatting.GRAY + " be in a single Amp"; + desc[1] = "Per each fuse, you may insert " + EnumChatFormatting.YELLOW + + (GT_Values.V[tTier]) + + EnumChatFormatting.GRAY + + " EU/t"; + desc[2] = "However this " + EnumChatFormatting.ITALIC + + EnumChatFormatting.RED + + "MUST" + + EnumChatFormatting.GRAY + + " be in a single Amp"; desc[3] = "This machine can accept upto a single amp of " + GT_Values.VN[Math.min(tTier + 2, 15)] + " as a result"; - desc[4] = "Breaker Loss: " + EnumChatFormatting.RED + "" + (GT_Values.V[tTier] / 16) + EnumChatFormatting.GRAY + desc[4] = "Breaker Loss: " + EnumChatFormatting.RED + + "" + + (GT_Values.V[tTier] / 16) + + EnumChatFormatting.GRAY + " EU/t"; desc[5] = CORE.GT_Tooltip; return desc; @@ -65,37 +75,30 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock ITexture[][][] rTextures = new ITexture[2][17][]; for (byte i = -1; i < 16; ++i) { - rTextures[0][i + 1] = new ITexture[] { - BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - this.mInventory.length > 4 - ? BlockIcons.OVERLAYS_ENERGY_IN_MULTI[Math.min(12, mTier)] - : BlockIcons.OVERLAYS_ENERGY_IN[Math.min(12, mTier)] - }; - - rTextures[1][i + 1] = new ITexture[] { - BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], - this.mInventory.length > 4 - ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] - : BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] - }; + rTextures[0][i + 1] = new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_IN_MULTI[Math.min(12, mTier)] + : BlockIcons.OVERLAYS_ENERGY_IN[Math.min(12, mTier)] }; + + rTextures[1][i + 1] = new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] + : BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; } return rTextures; } - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aFacing, - byte aColorIndex, - boolean aActive, - boolean aRedstone) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, + boolean aActive, boolean aRedstone) { return this.mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1]; } public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_BasicBreaker( - this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mInventory.length); + this.mName, + this.mTier, + this.mDescriptionArray, + this.mTextures, + this.mInventory.length); } public boolean isSimpleMachine() { @@ -198,23 +201,14 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide()) { - /*this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; - this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; - this.mBatteryCount = 0; - this.mChargeableCount = 0; - ItemStack[] arg3 = this.mInventory; - int arg4 = arg3.length; - - for (int arg5 = 0; arg5 < arg4; ++arg5) { - ItemStack tStack = arg3[arg5]; - if (GT_ModHandler.isElectricItem(tStack, this.mTier)) { - if (GT_ModHandler.isChargerItem(tStack)) { - ++this.mBatteryCount; - } - - ++this.mChargeableCount; - } - }*/ + /* + * this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; + * this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; + * this.mBatteryCount = 0; this.mChargeableCount = 0; ItemStack[] arg3 = this.mInventory; int arg4 = + * arg3.length; for (int arg5 = 0; arg5 < arg4; ++arg5) { ItemStack tStack = arg3[arg5]; if + * (GT_ModHandler.isElectricItem(tStack, this.mTier)) { if (GT_ModHandler.isChargerItem(tStack)) { + * ++this.mBatteryCount; } ++this.mChargeableCount; } } + */ } } @@ -274,11 +268,11 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock tStored = Long.MAX_VALUE; } - return new long[] {tStored, tScale}; + return new long[] { tStored, tScale }; } public String[] getInfoData() { - return new String[] {"Tile Type: " + this.getTileEntityBaseType()}; + return new String[] { "Tile Type: " + this.getTileEntityBaseType() }; } public boolean isGivingInformation() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java index cf92bdc0ba..a47ed592c4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java @@ -6,25 +6,10 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; public class GT_MetaTileEntity_BasicMachine_GTPP_Recipe extends GT_MetaTileEntity_BasicMachine_GT_Recipe { - public GT_MetaTileEntity_BasicMachine_GTPP_Recipe( - int aID, - String aName, - String aNameRegional, - int aTier, - String aDescription, - GT_Recipe_Map aRecipes, - int aInputSlots, - int aOutputSlots, - int aTankCapacity, - int aGUIParameterA, - int aGUIParameterB, - String aGUIName, - String aSound, - boolean aSharedTank, - boolean aRequiresFluidForFiltering, - int aSpecialEffect, - String aOverlays, - Object[] aRecipe) { + public GT_MetaTileEntity_BasicMachine_GTPP_Recipe(int aID, String aName, String aNameRegional, int aTier, + String aDescription, GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, + int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, + boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe) { super( aID, aName, @@ -46,24 +31,10 @@ public class GT_MetaTileEntity_BasicMachine_GTPP_Recipe extends GT_MetaTileEntit aRecipe); } - public GT_MetaTileEntity_BasicMachine_GTPP_Recipe( - String aName, - int aTier, - String aDescription, - GT_Recipe_Map aRecipes, - int aInputSlots, - int aOutputSlots, - int aTankCapacity, - int aAmperage, - int aGUIParameterA, - int aGUIParameterB, - ITexture[][][] aTextures, - String aGUIName, - String aNEIName, - String aSound, - boolean aSharedTank, - boolean aRequiresFluidForFiltering, - int aSpecialEffect) { + public GT_MetaTileEntity_BasicMachine_GTPP_Recipe(String aName, int aTier, String aDescription, + GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, + int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, + String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) { super( aName, aTier, @@ -84,24 +55,10 @@ public class GT_MetaTileEntity_BasicMachine_GTPP_Recipe extends GT_MetaTileEntit aSpecialEffect); } - public GT_MetaTileEntity_BasicMachine_GTPP_Recipe( - String aName, - int aTier, - String[] aDescription, - GT_Recipe_Map aRecipes, - int aInputSlots, - int aOutputSlots, - int aTankCapacity, - int aAmperage, - int aGUIParameterA, - int aGUIParameterB, - ITexture[][][] aTextures, - String aGUIName, - String aNEIName, - String aSound, - boolean aSharedTank, - boolean aRequiresFluidForFiltering, - int aSpecialEffect) { + public GT_MetaTileEntity_BasicMachine_GTPP_Recipe(String aName, int aTier, String[] aDescription, + GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, + int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, + String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) { super( aName, aTier, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Dehydrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Dehydrator.java index 7273977101..6852d7be5f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Dehydrator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Dehydrator.java @@ -31,8 +31,8 @@ public class GT_MetaTileEntity_Dehydrator extends GT_MetaTileEntity_BasicMachine // 3 8 } - public GT_MetaTileEntity_Dehydrator( - int aID, String aName, String aNameRegional, int aTier, String aDescription, int aTankCapacity) { + public GT_MetaTileEntity_Dehydrator(int aID, String aName, String aNameRegional, int aTier, String aDescription, + int aTankCapacity) { super( aID, aName, @@ -54,16 +54,9 @@ public class GT_MetaTileEntity_Dehydrator extends GT_MetaTileEntity_BasicMachine null); } - public GT_MetaTileEntity_Dehydrator( - String aName, - int aTier, - String[] aDescription, - GT_Recipe.GT_Recipe_Map aRecipes, - int aTankCapacity, - int aAmperage, - ITexture[][][] aTextures, - String aGUIName, - String aNEIName) { + public GT_MetaTileEntity_Dehydrator(String aName, int aTier, String[] aDescription, + GT_Recipe.GT_Recipe_Map aRecipes, int aTankCapacity, int aAmperage, ITexture[][][] aTextures, + String aGUIName, String aNEIName) { super( aName, aTier, @@ -116,13 +109,8 @@ public class GT_MetaTileEntity_Dehydrator extends GT_MetaTileEntity_BasicMachine } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { return super.getTexture(aBaseMetaTileEntity, aSide, aFacing, aColorIndex, aActive, aRedstone); // return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == // GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; @@ -130,87 +118,79 @@ public class GT_MetaTileEntity_Dehydrator extends GT_MetaTileEntity_BasicMachine @Override public ITexture[] getFrontFacingInactive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[0]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[0]) }; } @Override public ITexture[] getBottomFacingInactive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[2]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[2]) }; } @Override public ITexture[] getTopFacingInactive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[3]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[3]) }; } @Override public ITexture[] getSideFacingInactive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[4]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[4]) }; } @Override public ITexture[] getFrontFacingActive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[5]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[5]) }; } @Override public ITexture[] getBottomFacingActive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[7]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[7]) }; } @Override public ITexture[] getTopFacingActive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[8]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[8]) }; } @Override public ITexture[] getSideFacingActive(final byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(sDehydratorOverlays[9]) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], + new GT_RenderedTexture(sDehydratorOverlays[9]) }; } @Override public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) }; } @Override public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[] {MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; + return new ITexture[] { MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT) }; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java index 299580391a..8b39d1da32 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java @@ -2,6 +2,17 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import java.util.Arrays; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; + import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -16,78 +27,47 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.random.XSTR; -import java.util.Arrays; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidHandler; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! *

- * This is the main construct for my Basic Machines such as the Automatic Extractor - * Extend this class to make a simple Machine + * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple + * Machine */ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_DeluxeTank { + /** * return values for checkRecipe() */ - protected static final int DID_NOT_FIND_RECIPE = 0, - FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1, + protected static final int DID_NOT_FIND_RECIPE = 0, FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1, FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2; public static final int OTHER_SLOT_COUNT = 4; public final ItemStack[] mOutputItems; public final int mInputSlotCount, mAmperage; - public boolean mAllowInputFromOutputSide = false, - mFluidTransfer = false, - mItemTransfer = false, - mHasBeenUpdated = false, - mStuttering = false, - mCharge = false, - mDecharge = false; + public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false, + mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false; public int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0; public FluidStack mOutputFluid; public String mGUIName = "", mNEIName = ""; /** - * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have been buffered + * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have + * been buffered */ protected GT_Recipe mLastRecipe = null; private FluidStack mFluidOut; /** - * @param aOverlays 0 = SideFacingActive - * 1 = SideFacingInactive - * 2 = FrontFacingActive - * 3 = FrontFacingInactive - * 4 = TopFacingActive - * 5 = TopFacingInactive - * 6 = BottomFacingActive - * 7 = BottomFacingInactive - * ----- Not all Array Elements have to be initialised, you can also just use 8 Parameters for the Default Pipe Texture Overlays ----- - * 8 = BottomFacingPipeActive - * 9 = BottomFacingPipeInactive - * 10 = TopFacingPipeActive - * 11 = TopFacingPipeInactive - * 12 = SideFacingPipeActive - * 13 = SideFacingPipeInactive + * @param aOverlays 0 = SideFacingActive 1 = SideFacingInactive 2 = FrontFacingActive 3 = FrontFacingInactive 4 = + * TopFacingActive 5 = TopFacingInactive 6 = BottomFacingActive 7 = BottomFacingInactive ----- Not + * all Array Elements have to be initialised, you can also just use 8 Parameters for the Default + * Pipe Texture Overlays ----- 8 = BottomFacingPipeActive 9 = BottomFacingPipeInactive 10 = + * TopFacingPipeActive 11 = TopFacingPipeInactive 12 = SideFacingPipeActive 13 = + * SideFacingPipeInactive */ - public GT_MetaTileEntity_DeluxeMachine( - int aID, - String aName, - String aNameRegional, - int aTier, - int aAmperage, - String aDescription, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName, + public GT_MetaTileEntity_DeluxeMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, + String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) { super( aID, @@ -104,16 +84,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ mNEIName = aNEIName; } - public GT_MetaTileEntity_DeluxeMachine( - String aName, - int aTier, - int aAmperage, - String aDescription, - ITexture[][][] aTextures, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName) { + public GT_MetaTileEntity_DeluxeMachine(String aName, int aTier, int aAmperage, String aDescription, + ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) { super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures); mInputSlotCount = Math.max(0, aInputSlotCount); mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)]; @@ -137,13 +109,10 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ ITexture[][][] rTextures = new ITexture[14][17][]; aTextures = Arrays.copyOf(aTextures, 14); - for (int i = 0; i < aTextures.length; i++) - if (aTextures[i] != null) - for (byte c = -1; c < 16; c++) { - if (rTextures[i][c + 1] == null) - rTextures[i][c + 1] = - new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][c + 1], aTextures[i]}; - } + for (int i = 0; i < aTextures.length; i++) if (aTextures[i] != null) for (byte c = -1; c < 16; c++) { + if (rTextures[i][c + 1] == null) rTextures[i][c + 1] = new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][c + 1], aTextures[i] }; + } for (byte c = -1; c < 16; c++) { if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c); @@ -165,28 +134,16 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } @Override - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aFacing, - byte aColorIndex, - boolean aActive, - boolean aRedstone) { - return mTextures[ - mMainFacing < 2 - ? aSide == aFacing - ? aActive ? 2 : 3 - : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1 - : aSide == mMainFacing - ? aActive ? 2 : 3 - : (showPipeFacing() && aSide == aFacing) - ? aSide == 0 - ? aActive ? 8 : 9 - : aSide == 1 ? aActive ? 10 : 11 : aActive ? 12 : 13 - : aSide == 0 - ? aActive ? 6 : 7 - : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1][ - aColorIndex + 1]; + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, + boolean aActive, boolean aRedstone) { + return mTextures[mMainFacing < 2 + ? aSide == aFacing ? aActive ? 2 : 3 + : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1 + : aSide == mMainFacing ? aActive ? 2 : 3 + : (showPipeFacing() && aSide == aFacing) + ? aSide == 0 ? aActive ? 8 : 9 : aSide == 1 ? aActive ? 10 : 11 : aActive ? 12 : 13 + : aSide == 0 ? aActive ? 6 : 7 + : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1][aColorIndex + 1]; } @Override @@ -211,8 +168,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @Override public boolean isValidSlot(int aIndex) { - return aIndex > 0 - && super.isValidSlot(aIndex) + return aIndex > 0 && super.isValidSlot(aIndex) && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length; } @@ -243,9 +199,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @Override public boolean isLiquidInput(byte aSide) { - return aSide != mMainFacing - && (mAllowInputFromOutputSide - || aSide != getBaseMetaTileEntity().getFrontFacing()); + return aSide != mMainFacing && (mAllowInputFromOutputSide || aSide != getBaseMetaTileEntity().getFrontFacing()); } @Override @@ -336,8 +290,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @Override public boolean isFluidInputAllowed(FluidStack aFluid) { - return getFillableStack() != null - || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); + return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); } @Override @@ -416,9 +369,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ if (mOutputFluid != null) aNBT.setTag("mOutputFluid", mOutputFluid.writeToNBT(new NBTTagCompound())); if (mFluidOut != null) aNBT.setTag("mFluidOut", mFluidOut.writeToNBT(new NBTTagCompound())); - for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null) - aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound())); + for (int i = 0; i < mOutputItems.length; i++) if (mOutputItems[i] != null) + aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound())); } @Override @@ -457,9 +409,9 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) { if (++mProgresstime >= mMaxProgresstime) { for (int i = 0; i < mOutputItems.length; i++) - for (int j = 0; j < mOutputItems.length; j++) - if (aBaseMetaTileEntity.addStackToSlot( - getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) break; + for (int j = 0; j < mOutputItems.length; j++) if (aBaseMetaTileEntity + .addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) + break; if (mOutputFluid != null) if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy()); else if (mOutputFluid.isFluidEqual(getDrainableStack())) @@ -475,15 +427,14 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } if (mProgresstime > 5) mStuttering = false; XSTR aXSTR = new XSTR(); - if (false && aXSTR.nextInt(5000) == 0) - GT_Utility.sendSoundToPlayers( - aBaseMetaTileEntity.getWorld(), - GregTech_API.sSoundList.get(5), - 10.0F, - -1.0F, - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord()); + if (false && aXSTR.nextInt(5000) == 0) GT_Utility.sendSoundToPlayers( + aBaseMetaTileEntity.getWorld(), + GregTech_API.sSoundList.get(5), + 10.0F, + -1.0F, + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord()); } else { if (!mStuttering) { stutterProcess(); @@ -498,8 +449,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ boolean tRemovedOutputFluid = false; Logger.WARNING("R0"); - if (doesAutoOutputFluids() - && getDrainableStack() != null + if (doesAutoOutputFluids() && getDrainableStack() != null && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || aTick % 20 == 0)) { IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); @@ -507,28 +457,26 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ FluidStack tDrained = drain(1000, false); if (tDrained != null) { int tFilledAmount = tTank.fill( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); - if (tFilledAmount > 0) - tTank.fill( - ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), - drain(tFilledAmount, true), - true); + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + tDrained, + false); + if (tFilledAmount > 0) tTank.fill( + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + drain(tFilledAmount, true), + true); } } if (getDrainableStack() == null) tRemovedOutputFluid = true; } - if (doesAutoOutput() - && !isOutputEmpty() + if (doesAutoOutput() && !isOutputEmpty() && aBaseMetaTileEntity.getFrontFacing() != mMainFacing - && (tSucceeded - || mOutputBlocked % 300 == 1 + && (tSucceeded || mOutputBlocked % 300 == 1 || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0)) { TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); - for (int i = 0, tCosts = 1; - i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); - i++) { + for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 + && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) { tCosts = GT_Utility.moveOneItemStack( aBaseMetaTileEntity, tTileEntity2, @@ -544,9 +492,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } } - if (mOutputBlocked != 0) - if (isOutputEmpty()) mOutputBlocked = 0; - else mOutputBlocked++; + if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0; + else mOutputBlocked++; Logger.WARNING("R1"); if (allowToCheckRecipe()) { Logger.WARNING("R2--------------------------------------------------"); @@ -564,10 +511,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ Logger.WARNING("R2--------------------------------------------------"); Logger.WARNING("R2-hasEnoughEnergyToCheckRecipe(): " + hasEnoughEnergyToCheckRecipe()); Logger.WARNING("R2--------------------------------------------------"); - if (mMaxProgresstime <= 0 - && aBaseMetaTileEntity.isAllowedToWork() - && (tRemovedOutputFluid - || tSucceeded + if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() + && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) @@ -620,8 +565,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true)) mInventory[tDisplayStackSlot] = null; } else { - mInventory[tDisplayStackSlot] = - GT_Utility.getFluidDisplayStack(getFillableStack(), displaysStackSize()); + mInventory[tDisplayStackSlot] = GT_Utility + .getFluidDisplayStack(getFillableStack(), displaysStackSize()); } } } @@ -667,32 +612,27 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } protected boolean canOutput(GT_Recipe aRecipe) { - return aRecipe != null - && (aRecipe.mNeedsEmptyOutput - ? isOutputEmpty() && getDrainableStack() == null - : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs)); + return aRecipe != null && (aRecipe.mNeedsEmptyOutput ? isOutputEmpty() && getDrainableStack() == null + : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs)); } protected boolean canOutput(ItemStack... aOutputs) { if (aOutputs == null) return true; ItemStack[] tOutputSlots = getAllOutputs(); for (int i = 0; i < tOutputSlots.length && i < aOutputs.length; i++) - if (tOutputSlots[i] != null - && aOutputs[i] != null + if (tOutputSlots[i] != null && aOutputs[i] != null && (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false) || tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) { - mOutputBlocked++; - return false; - } + mOutputBlocked++; + return false; + } return true; } protected boolean canOutput(FluidStack aOutput) { - return getDrainableStack() == null - || aOutput == null - || (getDrainableStack().isFluidEqual(aOutput) - && (getDrainableStack().amount <= 0 - || getDrainableStack().amount + aOutput.amount <= getCapacity())); + return getDrainableStack() == null || aOutput == null + || (getDrainableStack().isFluidEqual(aOutput) && (getDrainableStack().amount <= 0 + || getDrainableStack().amount + aOutput.amount <= getCapacity())); } protected ItemStack getInputAt(int aIndex) { @@ -792,15 +732,9 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @Override public String[] getInfoData() { - return new String[] { - mNEIName, - "Progress:", - (mProgresstime / 20) + " secs", - (mMaxProgresstime / 20) + " secs", - "Stored Energy:", - getBaseMetaTileEntity().getStoredEU() + "EU", - getBaseMetaTileEntity().getEUCapacity() + "EU" - }; + return new String[] { mNEIName, "Progress:", (mProgresstime / 20) + " secs", (mMaxProgresstime / 20) + " secs", + "Stored Energy:", getBaseMetaTileEntity().getStoredEU() + "EU", + getBaseMetaTileEntity().getEUCapacity() + "EU" }; } @Override @@ -814,17 +748,15 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ mAllowInputFromOutputSide = !mAllowInputFromOutputSide; GT_Utility.sendChatToPlayer( aPlayer, - mAllowInputFromOutputSide - ? ("Input from Output Side allowed") + mAllowInputFromOutputSide ? ("Input from Output Side allowed") : ("Input from Output Side forbidden")); } } @Override public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return (aSide != mMainFacing - || GregTech_API.getCoverBehavior(aCoverID.toStack()) - .isGUIClickable(aSide, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity())); + return (aSide != mMainFacing || GregTech_API.getCoverBehavior(aCoverID.toStack()) + .isGUIClickable(aSide, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity())); } @Override @@ -834,10 +766,10 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (aSide == mMainFacing - || aIndex < getInputSlot() + if (aSide == mMainFacing || aIndex < getInputSlot() || aIndex >= getInputSlot() + mInputSlotCount - || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing())) return false; + || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing())) + return false; for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++) if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i])) return i == aIndex; return true; @@ -851,7 +783,8 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } /** - * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a special case + * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a + * special case *

* I thought about Enum too, but Enum doesn't add support for people adding other return Systems. *

@@ -885,13 +818,12 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ mLastRecipe, false, V[mTier], - new FluidStack[] {getFillableStack()}, + new FluidStack[] { getFillableStack() }, getSpecialSlot(), getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; - if (false - && tRecipe.mSpecialValue == -100 + if (false && tRecipe.mSpecialValue == -100 && !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId)) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; @@ -899,7 +831,7 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ mOutputBlocked++; return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } - if (!tRecipe.isRecipeInputEqual(true, new FluidStack[] {getFillableStack()}, getAllInputs())) + if (!tRecipe.isRecipeInputEqual(true, new FluidStack[] { getFillableStack() }, getAllInputs())) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; for (int i = 0; i < mOutputItems.length; i++) if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i)) @@ -910,76 +842,64 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ } public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1] }; } public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) - }; + return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java index 50c2237209..f57293f03c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java @@ -1,14 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.ItemList; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -22,23 +23,13 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas /** * @param aInvSlotCount should be 3 */ - public GT_MetaTileEntity_DeluxeTank( - final int aID, - final String aName, - final String aNameRegional, - final int aTier, - final int aInvSlotCount, - final String aDescription, - final ITexture... aTextures) { + public GT_MetaTileEntity_DeluxeTank(final int aID, final String aName, final String aNameRegional, final int aTier, + final int aInvSlotCount, final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_DeluxeTank( - final String aName, - final int aTier, - final int aInvSlotCount, - final String aDescription, - final ITexture[][][] aTextures) { + public GT_MetaTileEntity_DeluxeTank(final String aName, final int aTier, final int aInvSlotCount, + final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -164,35 +155,32 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas @Override public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - if (this.isFluidChangingAllowed() - && (this.getFillableStack() != null) + if (this.isFluidChangingAllowed() && (this.getFillableStack() != null) && (this.getFillableStack().amount <= 0)) { this.setFillableStack(null); } - if (this.displaysItemStack() - && (this.getStackDisplaySlot() >= 0) + if (this.displaysItemStack() && (this.getStackDisplaySlot() >= 0) && (this.getStackDisplaySlot() < this.mInventory.length)) { if (this.getDisplayedFluid() == null) { if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot()], true, true)) { this.mInventory[this.getStackDisplaySlot()] = null; } } else { - this.mInventory[this.getStackDisplaySlot()] = - GT_Utility.getFluidDisplayStack(this.getDisplayedFluid(), this.displaysStackSize()); + this.mInventory[this.getStackDisplaySlot()] = GT_Utility + .getFluidDisplayStack(this.getDisplayedFluid(), this.displaysStackSize()); } } - if (this.displaysItemStack() - && (this.getStackDisplaySlot2() >= 0) + if (this.displaysItemStack() && (this.getStackDisplaySlot2() >= 0) && (this.getStackDisplaySlot2() < this.mInventory.length)) { if (this.getDrainableStackEx(2) == null) { if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot2()], true, true)) { this.mInventory[this.getStackDisplaySlot2()] = null; } } else { - this.mInventory[this.getStackDisplaySlot2()] = - GT_Utility.getFluidDisplayStack(this.getDrainableStackEx(2), this.displaysStackSize()); + this.mInventory[this.getStackDisplaySlot2()] = GT_Utility + .getFluidDisplayStack(this.getDrainableStackEx(2), this.displaysStackSize()); } } @@ -223,39 +211,43 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas } } } - } else if (tFluid.isFluidEqual(this.getDrainableStackEx(2)) - || (this.getDrainableStackEx(2) == null)) { - if (this.getFillableStackEx(2) == null) { - if (this.isFluidInputAllowed(tFluid) && (tFluid.amount <= this.getCapacity())) { - if (aBaseMetaTileEntity.addStackToSlot( - this.getOutputSlot(), - GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), - 1)) { - this.setFillableStack2(tFluid.copy()); - aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } else + if (tFluid.isFluidEqual(this.getDrainableStackEx(2)) || (this.getDrainableStackEx(2) == null)) { + if (this.getFillableStackEx(2) == null) { + if (this.isFluidInputAllowed(tFluid) && (tFluid.amount <= this.getCapacity())) { + if (aBaseMetaTileEntity.addStackToSlot( + this.getOutputSlot(), + GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), + 1)) { + this.setFillableStack2(tFluid.copy()); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } } - } - } else { - if (tFluid.isFluidEqual(this.getFillableStackEx(2)) - && ((tFluid.amount + this.getFillableStackEx(2).amount) <= this.getCapacity())) { - if (aBaseMetaTileEntity.addStackToSlot( - this.getOutputSlot(), - GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), - 1)) { - this.getFillableStackEx(2).amount += tFluid.amount; - aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } else { + if (tFluid.isFluidEqual(this.getFillableStackEx(2)) + && ((tFluid.amount + this.getFillableStackEx(2).amount) + <= this.getCapacity())) { + if (aBaseMetaTileEntity.addStackToSlot( + this.getOutputSlot(), + GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), + 1)) { + this.getFillableStackEx(2).amount += tFluid.amount; + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } } } + } else { + Logger.INFO("Something broke when trying to empty cells between two fluid tank areas."); } - } else { - Logger.INFO("Something broke when trying to empty cells between two fluid tank areas."); - } } } if (this.doesFillContainers()) { final ItemStack tOutput = GT_Utility.fillFluidContainer( - this.getDrainableStack(), this.mInventory[this.getInputSlot()], false, true); + this.getDrainableStack(), + this.mInventory[this.getInputSlot()], + false, + true); if ((tOutput != null) && aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tOutput, 1)) { final FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); @@ -282,16 +274,14 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas @Override public int fill(final FluidStack aFluid, final boolean doFill) { - if ((aFluid == null) - || (aFluid.getFluid().getID() <= 0) + if ((aFluid