From 0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Mon, 30 Jan 2023 10:56:42 -0800 Subject: [ci skip] spotlessApply with the new settings --- .../implementations/GT_MetaPipeEntity_Cable.java | 371 ++++++------ .../implementations/GT_MetaPipeEntity_Fluid.java | 343 +++++------ .../implementations/GT_MetaPipeEntity_Frame.java | 43 +- .../implementations/GT_MetaPipeEntity_Item.java | 305 ++++------ .../GT_MetaTileEntity_BasicBatteryBuffer.java | 220 ++++--- .../GT_MetaTileEntity_BasicGenerator.java | 91 ++- .../GT_MetaTileEntity_BasicHull.java | 58 +- .../GT_MetaTileEntity_BasicHull_NonElectric.java | 22 +- .../GT_MetaTileEntity_BasicMachine.java | 641 +++++++++------------ .../GT_MetaTileEntity_BasicMachine_Bronze.java | 254 +++----- .../GT_MetaTileEntity_BasicMachine_GT_Recipe.java | 418 ++++++-------- .../GT_MetaTileEntity_BasicMachine_Steel.java | 151 ++--- .../GT_MetaTileEntity_BasicTank.java | 120 ++-- .../implementations/GT_MetaTileEntity_Buffer.java | 258 ++++----- .../GT_MetaTileEntity_CubicMultiBlockBase.java | 81 +-- .../GT_MetaTileEntity_EnhancedMultiBlockBase.java | 225 ++++---- ...MetaTileEntity_ExtendedPowerMultiBlockBase.java | 93 ++- .../implementations/GT_MetaTileEntity_Hatch.java | 80 ++- .../GT_MetaTileEntity_Hatch_DataAccess.java | 28 +- .../GT_MetaTileEntity_Hatch_Dynamo.java | 24 +- .../GT_MetaTileEntity_Hatch_Energy.java | 41 +- .../GT_MetaTileEntity_Hatch_Input.java | 53 +- .../GT_MetaTileEntity_Hatch_InputBus.java | 44 +- .../GT_MetaTileEntity_Hatch_Maintenance.java | 178 +++--- .../GT_MetaTileEntity_Hatch_Muffler.java | 62 +- .../GT_MetaTileEntity_Hatch_MultiInput.java | 71 ++- .../GT_MetaTileEntity_Hatch_Output.java | 182 +++--- .../GT_MetaTileEntity_Hatch_OutputBus.java | 52 +- .../GT_MetaTileEntity_MultiBlockBase.java | 493 ++++++++-------- .../GT_MetaTileEntity_SpecialFilter.java | 144 +++-- .../GT_MetaTileEntity_TieredMachineBlock.java | 54 +- .../GT_MetaTileEntity_TooltipMultiBlockBase.java | 11 +- .../GT_MetaTileEntity_Transformer.java | 253 ++++---- .../GT_MetaTileEntity_Wireless_Dynamo.java | 27 +- .../GT_MetaTileEntity_Wireless_Hatch.java | 30 +- 35 files changed, 2494 insertions(+), 3027 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index 750b50d652..1ea2e3e756 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -2,6 +2,22 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + import cofh.api.energy.IEnergyReceiver; import cpw.mods.fml.common.Loader; import gregtech.GT_Mod; @@ -36,33 +52,16 @@ import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergySource; import ic2.api.energy.tile.IEnergyTile; import ic2.api.reactor.IReactorChamber; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTileEntityCable { + public final float mThickNess; public final Materials mMaterial; public final long mCableLossPerMeter, mAmperage, mVoltage; public final boolean mInsulated, mCanShock; - public int mTransferredAmperage = 0, - mTransferredAmperageLast20 = 0, - mTransferredAmperageLast20OK = 0, + public int mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredAmperageLast20OK = 0, mTransferredAmperageOK = 0; - public long mTransferredVoltageLast20 = 0, - mTransferredVoltage = 0, - mTransferredVoltageLast20OK = 0, + public long mTransferredVoltageLast20 = 0, mTransferredVoltage = 0, mTransferredVoltageLast20OK = 0, mTransferredVoltageOK = 0; public long mRestRF; public int mOverheat; @@ -71,17 +70,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile private int[] lastAmperage; private long lastWorldTick; - public GT_MetaPipeEntity_Cable( - int aID, - String aName, - String aNameRegional, - float aThickNess, - Materials aMaterial, - long aCableLossPerMeter, - long aAmperage, - long aVoltage, - boolean aInsulated, - boolean aCanShock) { + public GT_MetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, + long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { super(aID, aName, aNameRegional, 0); mThickNess = aThickNess; mMaterial = aMaterial; @@ -92,15 +82,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile mCableLossPerMeter = aCableLossPerMeter; } - public GT_MetaPipeEntity_Cable( - String aName, - float aThickNess, - Materials aMaterial, - long aCableLossPerMeter, - long aAmperage, - long aVoltage, - boolean aInsulated, - boolean aCanShock) { + public GT_MetaPipeEntity_Cable(String aName, float aThickNess, Materials aMaterial, long aCableLossPerMeter, + long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { super(aName, 0); mThickNess = aThickNess; mMaterial = aMaterial; @@ -119,87 +102,77 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaPipeEntity_Cable( - mName, mThickNess, mMaterial, mCableLossPerMeter, mAmperage, mVoltage, mInsulated, mCanShock); - } - - @Override - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aConnections, - byte aColorIndex, - boolean aConnected, - boolean aRedstone) { - if (!mInsulated) - return new ITexture[] { - TextureFactory.of( - mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) - }; + mName, + mThickNess, + mMaterial, + mCableLossPerMeter, + mAmperage, + mVoltage, + mInsulated, + mCanShock); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, + byte aColorIndex, boolean aConnected, boolean aRedstone) { + if (!mInsulated) return new ITexture[] { TextureFactory.of( + mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; if (aConnected) { float tThickNess = getThickNess(); - if (tThickNess < 0.124F) - return new ITexture[] { - TextureFactory.of( - Textures.BlockIcons.INSULATION_FULL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + if (tThickNess < 0.124F) return new ITexture[] { TextureFactory.of( + Textures.BlockIcons.INSULATION_FULL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.374F) // 0.375 x1 - return new ITexture[] { - TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), - TextureFactory.of( - Textures.BlockIcons.INSULATION_TINY, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_TINY, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.499F) // 0.500 x2 - return new ITexture[] { - TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), - TextureFactory.of( - Textures.BlockIcons.INSULATION_SMALL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_SMALL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.624F) // 0.625 x4 - return new ITexture[] { - TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), - TextureFactory.of( - Textures.BlockIcons.INSULATION_MEDIUM, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_MEDIUM, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.749F) // 0.750 x8 - return new ITexture[] { - TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), - TextureFactory.of( - Textures.BlockIcons.INSULATION_MEDIUM_PLUS, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_MEDIUM_PLUS, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; if (tThickNess < 0.874F) // 0.825 x12 + return new ITexture[] { + TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), + TextureFactory.of( + Textures.BlockIcons.INSULATION_LARGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; return new ITexture[] { TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of( - Textures.BlockIcons.INSULATION_LARGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; - return new ITexture[] { - TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), - TextureFactory.of( - Textures.BlockIcons.INSULATION_HUGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + Textures.BlockIcons.INSULATION_HUGE, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } - return new ITexture[] { - TextureFactory.of( - Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) - }; + return new ITexture[] { TextureFactory.of( + Textures.BlockIcons.INSULATION_FULL, + Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; } @Override public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { - if (mCanShock - && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 + if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) GT_Utility.applyElectricityDamage( - (EntityLivingBase) aEntity, mTransferredVoltageLast20, mTransferredAmperageLast20); + (EntityLivingBase) aEntity, + mTransferredVoltageLast20, + mTransferredAmperageLast20); } @Override @@ -242,8 +215,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override @Deprecated - public long transferElectricity( - byte aSide, long aVoltage, long aAmperage, ArrayList aAlreadyPassedTileEntityList) { + public long transferElectricity(byte aSide, long aVoltage, long aAmperage, + ArrayList aAlreadyPassedTileEntityList) { return transferElectricity(aSide, aVoltage, aAmperage, new HashSet<>(aAlreadyPassedTileEntityList)); } @@ -275,24 +248,24 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { if (aBaseMetaTileEntity.isServerSide()) { lastAmperage = new int[16]; - lastWorldTick = aBaseMetaTileEntity.getWorld().getTotalWorldTime() - - 1; // sets initial value -1 since it is in the same tick as first on post tick + lastWorldTick = aBaseMetaTileEntity.getWorld().getTotalWorldTime() - 1; // sets initial value -1 since it is + // in the same tick as first on post + // tick } } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (aTick % 20 == 0 - && aBaseMetaTileEntity.isServerSide() + if (aTick % 20 == 0 && aBaseMetaTileEntity.isServerSide() && (!GT_Mod.gregtechproxy.gt6Cable || mCheckConnections)) { checkConnections(); } } @Override - public boolean onWireCutterRightClick( - byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, + float aZ) { if (GT_Mod.gregtechproxy.gt6Cable && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { if (isConnectedAtSide(aWrenchingSide)) { @@ -308,8 +281,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } @Override - public boolean onSolderingToolRightClick( - byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, + float aZ) { if (GT_Mod.gregtechproxy.gt6Cable && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) { if (isConnectedAtSide(aWrenchingSide)) { @@ -325,34 +298,26 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } @Override - public boolean letsIn( - GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, + ICoverable aTileEntity) { return coverBehavior.letsEnergyIn(aSide, aCoverID, aCoverVariable, aTileEntity); } @Override - public boolean letsOut( - GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, + ICoverable aTileEntity) { return coverBehavior.letsEnergyOut(aSide, aCoverID, aCoverVariable, aTileEntity); } @Override - public boolean letsIn( - GT_CoverBehaviorBase coverBehavior, - byte aSide, - int aCoverID, - ISerializableObject aCoverVariable, - ICoverable aTileEntity) { + public boolean letsIn(GT_CoverBehaviorBase coverBehavior, byte aSide, int aCoverID, + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsEnergyIn(aSide, aCoverID, aCoverVariable, aTileEntity); } @Override - public boolean letsOut( - GT_CoverBehaviorBase coverBehavior, - byte aSide, - int aCoverID, - ISerializableObject aCoverVariable, - ICoverable aTileEntity) { + public boolean letsOut(GT_CoverBehaviorBase coverBehavior, byte aSide, int aCoverID, + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsEnergyOut(aSide, aCoverID, aCoverVariable, aTileEntity); } @@ -374,9 +339,9 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile final ForgeDirection tDir = ForgeDirection.getOrientation(tSide); // GT Machine handling - if ((tTileEntity instanceof IEnergyConnected) - && (((IEnergyConnected) tTileEntity).inputEnergyFrom(tSide, false) - || ((IEnergyConnected) tTileEntity).outputsEnergyTo(tSide, false))) return true; + if ((tTileEntity instanceof IEnergyConnected) && (((IEnergyConnected) tTileEntity).inputEnergyFrom(tSide, false) + || ((IEnergyConnected) tTileEntity).outputsEnergyTo(tSide, false))) + return true; // Solar Panel Compat if (coverBehavior instanceof GT_Cover_SolarPanel) return true; @@ -398,15 +363,18 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (tTileEntity instanceof IReactorChamber) ic2Energy = (TileEntity) ((IReactorChamber) tTileEntity).getReactor(); - else - ic2Energy = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) - ? tTileEntity - : EnergyNet.instance.getTileEntity( - tTileEntity.getWorldObj(), tTileEntity.xCoord, tTileEntity.yCoord, tTileEntity.zCoord); + else ic2Energy = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) + ? tTileEntity + : EnergyNet.instance.getTileEntity( + tTileEntity.getWorldObj(), + tTileEntity.xCoord, + tTileEntity.yCoord, + tTileEntity.zCoord); // IC2 Sink Compat if ((ic2Energy instanceof IEnergySink) - && ((IEnergySink) ic2Energy).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) return true; + && ((IEnergySink) ic2Energy).acceptsEnergyFrom((TileEntity) baseMetaTile, tDir)) + return true; // IC2 Source Compat if (GT_Mod.gregtechproxy.ic2EnergySourceCompat && (ic2Energy instanceof IEnergySource)) { @@ -416,14 +384,13 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } } // RF Output Compat - if (GregTech_API.mOutputRF - && tTileEntity instanceof IEnergyReceiver - && ((IEnergyReceiver) tTileEntity).canConnectEnergy(tDir)) return true; + if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver + && ((IEnergyReceiver) tTileEntity).canConnectEnergy(tDir)) + return true; // RF Input Compat - return GregTech_API.mInputRF - && (tTileEntity instanceof IEnergyEmitter - && ((IEnergyEmitter) tTileEntity).emitsEnergyTo((TileEntity) baseMetaTile, tDir)); + return GregTech_API.mInputRF && (tTileEntity instanceof IEnergyEmitter + && ((IEnergyEmitter) tTileEntity).emitsEnergyTo((TileEntity) baseMetaTile, tDir)); } @Override @@ -445,16 +412,24 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public String[] getDescription() { return new String[] { - StatCollector.translateToLocal("GT5U.item.cable.max_voltage") + ": %%%" + EnumChatFormatting.GREEN - + GT_Utility.formatNumbers(mVoltage) + " (" - + GT_Utility.getColoredTierNameFromVoltage(mVoltage) - + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY, - StatCollector.translateToLocal("GT5U.item.cable.max_amperage") + ": %%%" + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mAmperage) + EnumChatFormatting.GRAY, - StatCollector.translateToLocal("GT5U.item.cable.loss") + ": %%%" + EnumChatFormatting.RED - + GT_Utility.formatNumbers(mCableLossPerMeter) + EnumChatFormatting.GRAY + "%%% " - + StatCollector.translateToLocal("GT5U.item.cable.eu_volt") - }; + StatCollector.translateToLocal("GT5U.item.cable.max_voltage") + ": %%%" + + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mVoltage) + + " (" + + GT_Utility.getColoredTierNameFromVoltage(mVoltage) + + EnumChatFormatting.GREEN + + ")" + + EnumChatFormatting.GRAY, + StatCollector.translateToLocal("GT5U.item.cable.max_amperage") + ": %%%" + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mAmperage) + + EnumChatFormatting.GRAY, + StatCollector.translateToLocal("GT5U.item.cable.loss") + ": %%%" + + EnumChatFormatting.RED + + GT_Utility.formatNumbers(mCableLossPerMeter) + + EnumChatFormatting.GRAY + + "%%% " + + StatCollector.translateToLocal("GT5U.item.cable.eu_volt") }; } @Override @@ -491,21 +466,38 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile volts = path.getVoltage(this); } return new String[] { - // EnumChatFormatting.BLUE + mName + EnumChatFormatting.RESET, - "Heat: " + EnumChatFormatting.RED - + GT_Utility.formatNumbers(mOverheat) + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW - + GT_Utility.formatNumbers(mMaxOverheat) + EnumChatFormatting.RESET, - "Max Load (1t):", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(amps) + EnumChatFormatting.RESET + " A / " - + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mAmperage) + EnumChatFormatting.RESET + " A", - "Max EU/p (1t):", - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(volts) + EnumChatFormatting.RESET + " EU / " - + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mVoltage) + EnumChatFormatting.RESET + " EU", - "Max Load (20t): " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mTransferredAmperageLast20OK) - + EnumChatFormatting.RESET + " A", - "Max EU/p (20t): " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mTransferredVoltageLast20OK) - + EnumChatFormatting.RESET + " EU" - }; + // EnumChatFormatting.BLUE + mName + EnumChatFormatting.RESET, + "Heat: " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(mOverheat) + + EnumChatFormatting.RESET + + " / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxOverheat) + + EnumChatFormatting.RESET, + "Max Load (1t):", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(amps) + + EnumChatFormatting.RESET + + " A / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mAmperage) + + EnumChatFormatting.RESET + + " A", + "Max EU/p (1t):", + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(volts) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mVoltage) + + EnumChatFormatting.RESET + + " EU", + "Max Load (20t): " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mTransferredAmperageLast20OK) + + EnumChatFormatting.RESET + + " A", + "Max EU/p (20t): " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mTransferredVoltageLast20OK) + + EnumChatFormatting.RESET + + " EU" }; } @Override @@ -557,19 +549,13 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB.getBoundingBox( - aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + return AxisAlignedBB + .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } @Override - public void addCollisionBoxesToList( - World aWorld, - int aX, - int aY, - int aZ, - AxisAlignedBB inputAABB, - List outputAABB, - Entity collider) { + public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, + List outputAABB, Entity collider) { super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { final AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); @@ -583,20 +569,19 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (mConnections != 0) { final IGregTechTileEntity baseMeta = getBaseMetaTileEntity(); - for (byte aSide = 0; aSide < 6; aSide++) - if (isConnectedAtSide(aSide)) { - final TileEntity tTileEntity = baseMeta.getTileEntityAtSide(aSide); - final TileEntity tEmitter = - (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) - ? tTileEntity - : EnergyNet.instance.getTileEntity( - tTileEntity.getWorldObj(), - tTileEntity.xCoord, - tTileEntity.yCoord, - tTileEntity.zCoord); - - if (tEmitter instanceof IEnergyEmitter) return true; - } + for (byte aSide = 0; aSide < 6; aSide++) if (isConnectedAtSide(aSide)) { + final TileEntity tTileEntity = baseMeta.getTileEntityAtSide(aSide); + final TileEntity tEmitter = (tTileEntity == null || tTileEntity instanceof IEnergyTile + || EnergyNet.instance == null) + ? tTileEntity + : EnergyNet.instance.getTileEntity( + tTileEntity.getWorldObj(), + tTileEntity.xCoord, + tTileEntity.yCoord, + tTileEntity.zCoord); + + if (tEmitter instanceof IEnergyEmitter) return true; + } } return false; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index 61d55bfd9b..29237218a1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -3,6 +3,25 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; + +import org.apache.commons.lang3.tuple.MutableTriple; + import cpw.mods.fml.common.Optional; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -21,24 +40,9 @@ import gregtech.common.GT_Client; import gregtech.common.covers.CoverInfo; import gregtech.common.covers.GT_Cover_Drain; import gregtech.common.covers.GT_Cover_FluidRegulator; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; -import org.apache.commons.lang3.tuple.MutableTriple; public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { + public final float mThickNess; public final Materials mMaterial; public final int mCapacity, mHeatResistance, mPipeAmount; @@ -50,28 +54,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { */ public byte mDisableInput = 0; - public GT_MetaPipeEntity_Fluid( - int aID, - String aName, - String aNameRegional, - float aThickNess, - Materials aMaterial, - int aCapacity, - int aHeatResistance, - boolean aGasProof) { + public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, + int aCapacity, int aHeatResistance, boolean aGasProof) { this(aID, aName, aNameRegional, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1); } - public GT_MetaPipeEntity_Fluid( - int aID, - String aName, - String aNameRegional, - float aThickNess, - Materials aMaterial, - int aCapacity, - int aHeatResistance, - boolean aGasProof, - int aFluidTypes) { + public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, + int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) { super(aID, aName, aNameRegional, 0, false); mThickNess = aThickNess; mMaterial = aMaterial; @@ -84,24 +73,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } @Deprecated - public GT_MetaPipeEntity_Fluid( - String aName, - float aThickNess, - Materials aMaterial, - int aCapacity, - int aHeatResistance, - boolean aGasProof) { + public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity, + int aHeatResistance, boolean aGasProof) { this(aName, aThickNess, aMaterial, aCapacity, aHeatResistance, aGasProof, 1); } - public GT_MetaPipeEntity_Fluid( - String aName, - float aThickNess, - Materials aMaterial, - int aCapacity, - int aHeatResistance, - boolean aGasProof, - int aFluidTypes) { + public GT_MetaPipeEntity_Fluid(String aName, float aThickNess, Materials aMaterial, int aCapacity, + int aHeatResistance, boolean aGasProof, int aFluidTypes) { super(aName, 0); mThickNess = aThickNess; mMaterial = aMaterial; @@ -120,79 +98,61 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaPipeEntity_Fluid( - mName, mThickNess, mMaterial, mCapacity, mHeatResistance, mGasProof, mPipeAmount); + mName, + mThickNess, + mMaterial, + mCapacity, + mHeatResistance, + mGasProof, + mPipeAmount); } @Override - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aConnections, - byte aColorIndex, - boolean aConnected, - boolean aRedstone) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, + byte aColorIndex, boolean aConnected, boolean aRedstone) { final float tThickNess = getThickNess(); if (mDisableInput == 0) - return new ITexture[] { - aConnected - ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) - : TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) - }; + return new ITexture[] { aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) + : TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; byte tMask = 0; - final byte[][] sRestrictionArray = { - {2, 3, 5, 4}, - {2, 3, 4, 5}, - {1, 0, 4, 5}, - {1, 0, 4, 5}, - {1, 0, 2, 3}, - {1, 0, 2, 3} - }; + final byte[][] sRestrictionArray = { { 2, 3, 5, 4 }, { 2, 3, 4, 5 }, { 1, 0, 4, 5 }, { 1, 0, 4, 5 }, + { 1, 0, 2, 3 }, { 1, 0, 2, 3 } }; if (aSide >= 0 && aSide < 6) { for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i; - // Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate + // Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate if (aSide == 5 || aSide == 2) if (tMask > 3 && tMask < 12) tMask = (byte) (tMask ^ 12); } - return new ITexture[] { - aConnected - ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) - : TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), - getRestrictorTexture(tMask) - }; + return new ITexture[] { aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) + : TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), + getRestrictorTexture(tMask) }; } protected static ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, byte aColorIndex) { - if (aPipeAmount >= 9) - return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aPipeAmount >= 4) - return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.124F) - return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.374F) - return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.499F) - return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.749F) - return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.874F) - return TextureFactory.of( - aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aPipeAmount >= 9) return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aPipeAmount >= 4) return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.124F) return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.374F) return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.499F) return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.749F) return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.874F) return TextureFactory.of( + aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); return TextureFactory.of( aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); @@ -277,9 +237,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public void saveNBTData(NBTTagCompound aNBT) { - for (int i = 0; i < mPipeAmount; i++) - if (mFluids[i] != null) - aNBT.setTag("mFluid" + (i == 0 ? "" : i), mFluids[i].writeToNBT(new NBTTagCompound())); + for (int i = 0; i < mPipeAmount; i++) if (mFluids[i] != null) + aNBT.setTag("mFluid" + (i == 0 ? "" : i), mFluids[i].writeToNBT(new NBTTagCompound())); aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom); if (GT_Mod.gregtechproxy.gt6Pipe) { aNBT.setByte("mConnections", mConnections); @@ -305,17 +264,17 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { for (FluidStack tFluid : mFluids) { if (tFluid != null) { final int tTemperature = tFluid.getFluid().getTemperature(tFluid); - if (tTemperature > 320 - && !isCoverOnSide( - (BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { + if (tTemperature > 320 && !isCoverOnSide( + (BaseMetaPipeEntity) getBaseMetaTileEntity(), + (EntityLivingBase) aEntity)) { GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, (tTemperature - 300) / 50.0F); break; - } else if (tTemperature < 260 - && !isCoverOnSide( - (BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { - GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F); - break; - } + } else if (tTemperature < 260 && !isCoverOnSide( + (BaseMetaPipeEntity) getBaseMetaTileEntity(), + (EntityLivingBase) aEntity)) { + GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F); + break; + } } } } @@ -361,25 +320,33 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { // Poof GT_Log.exp.println( "Set Pipe to Fire due to to low heat resistance at " + aBaseMetaTileEntity.getXCoord() - + " | " + aBaseMetaTileEntity.getYCoord() + " | " + aBaseMetaTileEntity.getZCoord() - + " DIMID: " + aBaseMetaTileEntity.getWorld().provider.dimensionId); + + " | " + + aBaseMetaTileEntity.getYCoord() + + " | " + + aBaseMetaTileEntity.getZCoord() + + " DIMID: " + + aBaseMetaTileEntity.getWorld().provider.dimensionId); aBaseMetaTileEntity.setToFire(); return true; } // Mmhmm, Fire aBaseMetaTileEntity.setOnFire(); - GT_Log.exp.println("Set Blocks around Pipe to Fire due to to low heat resistance at " - + aBaseMetaTileEntity.getXCoord() + " | " + aBaseMetaTileEntity.getYCoord() + " | " - + aBaseMetaTileEntity.getZCoord() + " DIMID: " - + aBaseMetaTileEntity.getWorld().provider.dimensionId); + GT_Log.exp.println( + "Set Blocks around Pipe to Fire due to to low heat resistance at " + + aBaseMetaTileEntity.getXCoord() + + " | " + + aBaseMetaTileEntity.getYCoord() + + " | " + + aBaseMetaTileEntity.getZCoord() + + " DIMID: " + + aBaseMetaTileEntity.getWorld().provider.dimensionId); } if (!mGasProof && tFluid.getFluid().isGaseous(tFluid)) { tFluid.amount -= 5; sendSound((byte) 9); if (tTemperature > 320) { try { - for (EntityLivingBase tLiving : (ArrayList) getBaseMetaTileEntity() - .getWorld() + for (EntityLivingBase tLiving : (ArrayList) getBaseMetaTileEntity().getWorld() .getEntitiesWithinAABB( EntityLivingBase.class, AxisAlignedBB.getBoundingBox( @@ -396,8 +363,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } } else if (tTemperature < 260) { try { - for (EntityLivingBase tLiving : (ArrayList) getBaseMetaTileEntity() - .getWorld() + for (EntityLivingBase tLiving : (ArrayList) getBaseMetaTileEntity().getWorld() .getEntitiesWithinAABB( EntityLivingBase.class, AxisAlignedBB.getBoundingBox( @@ -434,8 +400,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { final IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aSide); final IGregTechTileEntity gTank = tTank instanceof IGregTechTileEntity ? (IGregTechTileEntity) tTank : null; - if (isConnectedAtSide(aSide) - && tTank != null + if (isConnectedAtSide(aSide) && tTank != null && (mLastReceivedFrom & (1 << aSide)) == 0 && getBaseMetaTileEntity().getCoverInfoAtSide(aSide).letsFluidOut(tFluid.getFluid()) && (gTank == null || gTank.getCoverInfoAtSide(tSide).letsFluidIn(tFluid.getFluid()))) { @@ -470,8 +435,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (tEntry.right <= 0) continue; - final int tFilledAmount = - tEntry.left.fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false); + final int tFilledAmount = tEntry.left + .fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false); if (tFilledAmount > 0) tEntry.left.fill(tEntry.middle, drainFromIndex(tFilledAmount, true, index), true); @@ -480,8 +445,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } @Override - public boolean onWrenchRightClick( - byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, + float aZ) { if (GT_Mod.gregtechproxy.gt6Pipe) { final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); final byte tMask = (byte) (1 << tSide); @@ -508,34 +473,26 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } @Override - public boolean letsIn( - GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsIn(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, + ICoverable aTileEntity) { return coverBehavior.letsFluidIn(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @Override - public boolean letsOut( - GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + public boolean letsOut(GT_CoverBehavior coverBehavior, byte aSide, int aCoverID, int aCoverVariable, + ICoverable aTileEntity) { return coverBehavior.letsFluidOut(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @Override - public boolean letsIn( - GT_CoverBehaviorBase coverBehavior, - byte aSide, - int aCoverID, - ISerializableObject aCoverVariable, - ICoverable aTileEntity) { + public boolean letsIn(GT_CoverBehaviorBase coverBehavior, byte aSide, int aCoverID, + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsFluidIn(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @Override - public boolean letsOut( - GT_CoverBehaviorBase coverBehavior, - byte aSide, - int aCoverID, - ISerializableObject aCoverVariable, - ICoverable aTileEntity) { + public boolean letsOut(GT_CoverBehaviorBase coverBehavior, byte aSide, int aCoverID, + ISerializableObject aCoverVariable, ICoverable aTileEntity) { return coverBehavior.letsFluidOut(aSide, aCoverID, aCoverVariable, null, aTileEntity); } @@ -553,14 +510,14 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public boolean canConnect(byte aSide, TileEntity tTileEntity) { if (tTileEntity == null) return false; - final byte tSide = - (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); + final byte tSide = (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity(); if (baseMetaTile == null) return false; final GT_CoverBehaviorBase coverBehavior = baseMetaTile.getCoverBehaviorAtSideNew(aSide); - final IGregTechTileEntity gTileEntity = - (tTileEntity instanceof IGregTechTileEntity) ? (IGregTechTileEntity) tTileEntity : null; + final IGregTechTileEntity gTileEntity = (tTileEntity instanceof IGregTechTileEntity) + ? (IGregTechTileEntity) tTileEntity + : null; if (coverBehavior instanceof GT_Cover_Drain || (GregTech_API.mTConstruct && isTConstructFaucet(tTileEntity))) return true; @@ -570,8 +527,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (fTileEntity != null) { final FluidTankInfo[] tInfo = fTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide)); if (tInfo != null) { - return tInfo.length > 0 - || (GregTech_API.mTranslocator && isTranslocator(tTileEntity)) + return tInfo.length > 0 || (GregTech_API.mTranslocator && isTranslocator(tTileEntity)) || gTileEntity != null && gTileEntity.getCoverBehaviorAtSideNew(tSide) instanceof GT_Cover_FluidRegulator; } @@ -603,18 +559,19 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (aIndex == 9) { GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 5, 1.0F, aX, aY, aZ); - new ParticleEventBuilder() - .setIdentifier(ParticleFX.CLOUD) - .setWorld(getBaseMetaTileEntity().getWorld()) - .times(6, (x, i) -> x.setMotion( - ForgeDirection.getOrientation(i).offsetX / 5.0, - ForgeDirection.getOrientation(i).offsetY / 5.0, - ForgeDirection.getOrientation(i).offsetZ / 5.0) - .setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat()) - .run()); + new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD).setWorld(getBaseMetaTileEntity().getWorld()) + .times( + 6, + (x, i) -> x + .setMotion( + ForgeDirection.getOrientation(i).offsetX / 5.0, + ForgeDirection.getOrientation(i).offsetY / 5.0, + ForgeDirection.getOrientation(i).offsetZ / 5.0) + .setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat()) + .run()); } } @@ -763,19 +720,25 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { public String[] getDescription() { if (mPipeAmount == 1) { return new String[] { - EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + GT_Utility.formatNumbers(mCapacity * 20L) - + "%%% L/sec" + EnumChatFormatting.GRAY, - EnumChatFormatting.RED + "Heat Limit: %%%" + GT_Utility.formatNumbers(mHeatResistance) + "%%% K" - + EnumChatFormatting.GRAY - }; + EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + + GT_Utility.formatNumbers(mCapacity * 20L) + + "%%% L/sec" + + EnumChatFormatting.GRAY, + EnumChatFormatting.RED + "Heat Limit: %%%" + + GT_Utility.formatNumbers(mHeatResistance) + + "%%% K" + + EnumChatFormatting.GRAY }; } else { return new String[] { - EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + GT_Utility.formatNumbers(mCapacity * 20L) - + "%%% L/sec" + EnumChatFormatting.GRAY, - EnumChatFormatting.RED + "Heat Limit: %%%" + GT_Utility.formatNumbers(mHeatResistance) + "%%% K" - + EnumChatFormatting.GRAY, - EnumChatFormatting.AQUA + "Pipe Amount: %%%" + mPipeAmount + EnumChatFormatting.GRAY - }; + EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + + GT_Utility.formatNumbers(mCapacity * 20L) + + "%%% L/sec" + + EnumChatFormatting.GRAY, + EnumChatFormatting.RED + "Heat Limit: %%%" + + GT_Utility.formatNumbers(mHeatResistance) + + "%%% K" + + EnumChatFormatting.GRAY, + EnumChatFormatting.AQUA + "Pipe Amount: %%%" + mPipeAmount + EnumChatFormatting.GRAY }; } } @@ -848,19 +811,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; - return AxisAlignedBB.getBoundingBox( - aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + return AxisAlignedBB + .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } @Override - public void addCollisionBoxesToList( - World aWorld, - int aX, - int aY, - int aZ, - AxisAlignedBB inputAABB, - List outputAABB, - Entity collider) { + public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, + List outputAABB, Entity collider) { super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { final AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java index d50c4fc165..e449921d1d 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java @@ -3,6 +3,9 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.RA; import static gregtech.api.util.GT_Utility.calculateRecipeEU; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -13,12 +16,11 @@ import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_ModHandler.RecipeBits; import gregtech.api.util.GT_OreDictUnificator; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { - private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization( - "gt.blockmachines.gt_frame.desc.format", "Just something you can put covers on."); + + private static final String localizedDescFormat = GT_LanguageManager + .addStringLocalization("gt.blockmachines.gt_frame.desc.format", "Just something you can put covers on."); public final Materials mMaterial; public GT_MetaPipeEntity_Frame(int aID, String aName, String aNameRegional, Materials aMaterial) { @@ -30,7 +32,7 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { GT_ModHandler.addCraftingRecipe( getStackForm(2), RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] {"SSS", "SwS", "SSS", 'S', OrePrefixes.stick.get(mMaterial)}); + new Object[] { "SSS", "SwS", "SSS", 'S', OrePrefixes.stick.get(mMaterial) }); } if (!aMaterial.contains(SubTag.NO_RECIPES)) { @@ -60,18 +62,11 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { } @Override - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aConnections, - byte aColorIndex, - boolean aConnected, - boolean aRedstone) { - return new ITexture[] { - TextureFactory.of( - mMaterial.mIconSet.mTextures[OrePrefixes.frameGt.mTextureIndex], - Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) - }; + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, + byte aColorIndex, boolean aConnected, boolean aRedstone) { + return new ITexture[] { TextureFactory.of( + mMaterial.mIconSet.mTextures[OrePrefixes.frameGt.mTextureIndex], + Dyes.getModulation(aColorIndex, mMaterial.mRGBa)) }; } @Override @@ -106,23 +101,23 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { @Override public final void saveNBTData(NBTTagCompound aNBT) { - /*Do nothing*/ + /* Do nothing */ } @Override public final void loadNBTData(NBTTagCompound aNBT) { - /*Do nothing*/ + /* Do nothing */ } @Override - public final boolean allowPutStack( - IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public final boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + ItemStack aStack) { return false; } @Override - public final boolean allowPullStack( - IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public final boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, + ItemStack aStack) { return false; } @@ -133,7 +128,7 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { @Override public void disconnect(byte aSide) { - /* Do nothing*/ + /* Do nothing */ } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java index 5ae9150a58..5d2211528b 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java @@ -3,6 +3,23 @@ package gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; import static gregtech.api.enums.Textures.BlockIcons.PIPE_RESTRICTOR; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityDispenser; +import net.minecraft.tileentity.TileEnti