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 --- .../api/metatileentity/BaseCustomTileEntity.java | 30 +- .../custom/power/BaseCustomPower_MTE.java | 20 +- .../power/GTPP_MTE_BasicLosslessGenerator.java | 104 +- .../custom/power/GTPP_MTE_BasicMachine.java | 329 ++--- .../custom/power/GTPP_MTE_BasicTank.java | 49 +- .../custom/power/GTPP_MTE_TieredMachineBlock.java | 37 +- .../custom/power/MetaTileEntityCustomPower.java | 54 +- .../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 +-- 50 files changed, 2598 insertions(+), 3283 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java index a88105f7f6..aae4494f88 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java @@ -1,5 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Random; + +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; @@ -12,12 +20,6 @@ import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.interfaces.IBaseCustomMetaTileEntity; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import ic2.api.Direction; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Random; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public class BaseCustomTileEntity extends BaseMetaTileEntity implements IBaseCustomMetaTileEntity { @@ -76,16 +78,13 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity implements IBaseCus } if (this.getUniversalEnergyCapacity() > 0L && this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 5L) { - this.doExplosion(this.getOutput() - * (long) - (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() - ? 4 - : (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 2L - ? 2 - : 1))); + this.doExplosion( + this.getOutput() * (long) (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() ? 4 + : (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 2L ? 2 : 1))); GT_Mod arg9999 = GT_Mod.instance; GT_Mod.achievements.issueAchievement( - this.getWorldObj().getPlayerEntityByName(this.getOwnerName()), "electricproblems"); + this.getWorldObj().getPlayerEntityByName(this.getOwnerName()), + "electricproblems"); } } @@ -147,8 +146,7 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity implements IBaseCus (double) ((float) this.zCoord + tRandom.nextFloat() * 0.8F + 0.1F), new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); if (tItem.hasTagCompound()) { - tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) - tItem.getTagCompound().copy()); + tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy()); } tItemEntity.motionX = tRandom.nextGaussian() * 0.0500000007450581D; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java index b3d8b8aa8c..ba67ba6466 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java @@ -1,10 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; import ic2.api.Direction; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; public class BaseCustomPower_MTE extends BaseCustomTileEntity { @@ -21,8 +22,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { if (mMetaTileEntity == null) { Logger.INFO("Bad Tile"); } - if (this.canAccessData() - && this.mMetaTileEntity.isElectric() + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.inputEnergyFrom(aSide) && aAmperage > 0L && aVoltage > 0L @@ -37,8 +37,9 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { Logger.INFO("aAmperage: " + aAmperage); Logger.INFO("aVoltage: " + aVoltage); Logger.INFO("this.getStoredEU() < this.getEUCapacity(): " + (this.getStoredEU() < this.getEUCapacity())); - Logger.INFO("this.mMetaTileEntity.maxAmperesIn() >= this.mAcceptedAmperes: " - + (this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage())); + Logger.INFO( + "this.mMetaTileEntity.maxAmperesIn() >= this.mAcceptedAmperes: " + + (this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage())); Logger.INFO("this.mMetaTileEntity.maxAmperesIn(): " + (this.mMetaTileEntity.maxAmperesIn())); Logger.INFO("this.mAcceptedAmperes: " + (this.getInputAmperage())); return 0L; @@ -47,13 +48,12 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { Logger.INFO("Draining Energy Units 4"); - if (this.canAccessData() - && this.mMetaTileEntity.isElectric() + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.outputsEnergyTo(aSide) && this.getStoredEU() - aVoltage * aAmperage >= this.mMetaTileEntity.getMinimumStoredEU()) { if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { - this.mAverageEUOutput[this.mAverageEUOutputIndex] = - (int) ((long) this.mAverageEUOutput[this.mAverageEUOutputIndex] + aVoltage * aAmperage); + this.mAverageEUOutput[this.mAverageEUOutputIndex] = (int) ((long) this.mAverageEUOutput[this.mAverageEUOutputIndex] + + aVoltage * aAmperage); return true; } else { return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java index 841359c0b2..0060cba12c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java @@ -1,5 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; +import java.util.Collection; +import java.util.Iterator; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.gui.modularui.GT_UIInfos; @@ -10,21 +18,16 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import java.util.Collection; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank { - public GTPP_MTE_BasicLosslessGenerator( - int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { + + public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription, + ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); } - public GTPP_MTE_BasicLosslessGenerator( - int aID, String aName, String aNameRegional, int aTier, String[] aDescription, ITexture... aTextures) { + public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier, + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); } @@ -55,21 +58,11 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank return rTextures; } - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aFacing, - byte aColorIndex, - boolean aActive, - boolean 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]; + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, + boolean aActive, boolean 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]; } public String[] getDescription() { @@ -86,23 +79,23 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank } public ITexture[] getFront(byte aColor) { - return new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getBack(byte aColor) { - return new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getBottom(byte aColor) { - return new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getTop(byte aColor) { - return new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getSides(byte aColor) { - return new ITexture[] {BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + return new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1] }; } public ITexture[] getFrontActive(byte aColor) { @@ -198,8 +191,10 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); } - this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " - + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); + this.mInventory[this.getStackDisplaySlot()].setStackDisplayName( + "Generating: " + + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + + " EU"); } } else { tFuelValue = this.getFuelValue(this.mFluid); @@ -208,9 +203,8 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank long tFluidAmountToUse = Math.min( (long) (this.mFluid.amount / tConsumed), (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / (long) tFuelValue); - if (tFluidAmountToUse > 0L - && aBaseMetaTileEntity.increaseStoredEnergyUnits( - tFluidAmountToUse * (long) tFuelValue, true)) { + if (tFluidAmountToUse > 0L && aBaseMetaTileEntity + .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) { PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); this.mFluid.amount = (int) ((long) this.mFluid.amount - tFluidAmountToUse * (long) tConsumed); } @@ -235,8 +229,8 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank if (aBaseMetaTileEntity.isServerSide()) { Logger.WARNING("Ticking Servside"); - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() - && aBaseMetaTileEntity.getUniversalEnergyStored() + aBaseMetaTileEntity.setActive( + aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU()); } } @@ -264,15 +258,13 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null && aLiquid.isFluidEqual(tLiquid)) { Logger.WARNING("Fuel Ok"); - return (int) ((long) tFuel.mSpecialValue - * (long) this.getEfficiency() + return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency() * (long) this.consumedFluidPerOperation(tLiquid) / 100L); } if ((tLiquid = tFuel.getRepresentativeFluidInput(0)) != null && aLiquid.isFluidEqual(tLiquid)) { Logger.WARNING("Fuel Ok"); - return (int) ((long) tFuel.mSpecialValue - * (long) this.getEfficiency() + return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency() * (long) this.consumedFluidPerOperation(tLiquid) / 100L); } @@ -288,11 +280,12 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank public int getFuelValue(ItemStack aStack) { if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) { Logger.WARNING("Fuel Item OK"); - GT_Recipe tFuel = this.getRecipes() - .findRecipe( - this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, (FluidStack[]) null, new ItemStack[] { - aStack - }); + GT_Recipe tFuel = this.getRecipes().findRecipe( + this.getBaseMetaTileEntity(), + false, + Long.MAX_VALUE, + (FluidStack[]) null, + new ItemStack[] { aStack }); return tFuel != null ? (int) ((long) tFuel.mSpecialValue * 1000L * (long) this.getEfficiency() / 100L) : 0; } else { return 0; @@ -301,13 +294,13 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank public ItemStack getEmptyContainer(ItemStack aStack) { if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) { - GT_Recipe tFuel = this.getRecipes() - .findRecipe( - this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, (FluidStack[]) null, new ItemStack[] { - aStack - }); - return tFuel != null - ? GT_Utility.copy(new Object[] {tFuel.getOutput(0)}) + GT_Recipe tFuel = this.getRecipes().findRecipe( + this.getBaseMetaTileEntity(), + false, + Long.MAX_VALUE, + (FluidStack[]) null, + new ItemStack[] { aStack }); + return tFuel != null ? GT_Utility.copy(new Object[] { tFuel.getOutput(0) }) : GT_Utility.getContainerItem(aStack, true); } else { return null; @@ -315,9 +308,8 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank } public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) - && (this.getFuelValue(aStack) > 0 - || this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0); + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (this.getFuelValue(aStack) > 0 + || this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0); } public int getCapacity() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java index cb3f42b6f6..2721dc437e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java @@ -2,6 +2,17 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; 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,79 +27,48 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; 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 GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { + /** * 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 = ""; public GT_MetaTileEntity_MultiBlockBase mCleanroom; /** - * 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 GTPP_MTE_BasicMachine( - int aID, - String aName, - String aNameRegional, - int aTier, - int aAmperage, - String aDescription, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName, + public GTPP_MTE_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, + String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) { super( aID, @@ -105,17 +85,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { mNEIName = aNEIName; } - public GTPP_MTE_BasicMachine( - int aID, - String aName, - String aNameRegional, - int aTier, - int aAmperage, - String[] aDescription, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName, + public GTPP_MTE_BasicMachine(int aID, String aName, String aNameRegional, int aTier, int aAmperage, + String[] aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) { super( aID, @@ -132,16 +103,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { mNEIName = aNEIName; } - public GTPP_MTE_BasicMachine( - String aName, - int aTier, - int aAmperage, - String aDescription, - ITexture[][][] aTextures, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName) { + public GTPP_MTE_BasicMachine(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)]; @@ -150,16 +113,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { mNEIName = aNEIName; } - public GTPP_MTE_BasicMachine( - String aName, - int aTier, - int aAmperage, - String[] aDescription, - ITexture[][][] aTextures, - int aInputSlotCount, - int aOutputSlotCount, - String aGUIName, - String aNEIName) { + public GTPP_MTE_BasicMachine(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)]; @@ -188,13 +143,10 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { 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); @@ -216,28 +168,16 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { } @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 @@ -262,8 +202,7 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @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; } @@ -294,9 +233,7 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @Override public boolean isLiquidInput(byte aSide) { - return aSide != mMainFacing - && (mAllowInputFromOutputSide - || aSide != getBaseMetaTileEntity().getFrontFacing()); + return aSide != mMainFacing && (mAllowInputFromOutputSide || aSide != getBaseMetaTileEntity().getFrontFacing()); } @Override @@ -387,8 +324,7 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @Override public boolean isFluidInputAllowed(FluidStack aFluid) { - return getFillableStack() != null - || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); + return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid)); } @Override @@ -467,9 +403,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { 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 @@ -506,9 +441,9 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { 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())) @@ -542,8 +477,7 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { boolean tRemovedOutputFluid = false; - if (doesAutoOutputFluids() - && getDrainableStack() != null + if (doesAutoOutputFluids() && getDrainableStack() != null && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || aTick % 20 == 0)) { IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); @@ -551,28 +485,26 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { 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, @@ -588,15 +520,12 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { } } - if (mOutputBlocked != 0) - if (isOutputEmpty()) mOutputBlocked = 0; - else mOutputBlocked++; + if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0; + else mOutputBlocked++; if (allowToCheckRecipe()) { - if (mMaxProgresstime <= 0 - && aBaseMetaTileEntity.isAllowedToWork() - && (tRemovedOutputFluid - || tSucceeded + if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() + && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) @@ -647,8 +576,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { 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()); } } } @@ -694,32 +623,27 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { } 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) { @@ -819,15 +743,9 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @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 @@ -847,9 +765,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @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 @@ -859,10 +776,10 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @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; @@ -876,7 +793,8 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { } /** - * 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. *

@@ -910,7 +828,7 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { mLastRecipe, false, V[mTier], - new FluidStack[] {getFillableStack()}, + new FluidStack[] { getFillableStack() }, getSpecialSlot(), getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; @@ -922,91 +840,78 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { } if (tRecipe.mSpecialValue == -200 && (mCleanroom == null || mCleanroom.mEfficiency == 0)) 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)) mOutputItems[i] = tRecipe.getOutput(i); - if (tRecipe.mSpecialValue == -200) - for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) > mCleanroom.mEfficiency) - mOutputItems[i] = null; + if (tRecipe.mSpecialValue == -200) for (int i = 0; i < mOutputItems.length; i++) + if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) > mCleanroom.mEfficiency) + mOutputItems[i] = null; mOutputFluid = tRecipe.getFluidOutput(0); calculateOverclockedNess(tRecipe); return FOUND_AND_SUCCESSFULLY_USED_RECIPE; } 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/custom/power/GTPP_MTE_BasicTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java index 7e2cfaa94a..679b007111 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java @@ -1,12 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; +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.util.GT_Utility; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -20,35 +21,23 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { /** * @param aInvSlotCount should be 3 */ - public GTPP_MTE_BasicTank( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInvSlotCount, - String aDescription, - ITexture... aTextures) { + public GTPP_MTE_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, + String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GTPP_MTE_BasicTank( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInvSlotCount, - String[] aDescription, - ITexture... aTextures) { + public GTPP_MTE_BasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GTPP_MTE_BasicTank( - String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GTPP_MTE_BasicTank(String aName, int aTier, int aInvSlotCount, String aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GTPP_MTE_BasicTank( - String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GTPP_MTE_BasicTank(String aName, int aTier, int aInvSlotCount, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -137,8 +126,8 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true)) mInventory[getStackDisplaySlot()] = null; } else { - mInventory[getStackDisplaySlot()] = - GT_Utility.getFluidDisplayStack(getDisplayedFluid(), displaysStackSize()); + mInventory[getStackDisplaySlot()] = GT_Utility + .getFluidDisplayStack(getDisplayedFluid(), displaysStackSize()); } } @@ -172,8 +161,8 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { } if (doesFillContainers()) { - ItemStack tOutput = - GT_Utility.fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true); + ItemStack tOutput = GT_Utility + .fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true); if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tOutput, 1)) { FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); @@ -196,11 +185,11 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { @Override public int fill(FluidStack aFluid, boolean doFill) { - if (aFluid == null - || aFluid.getFluid().getID() <= 0 + if (aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() - || !isFluidInputAllowed(aFluid)) return 0; + || !isFluidInputAllowed(aFluid)) + return 0; if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) { if (aFluid.amount <= getCapacity()) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java index e45588e126..51596dd8cd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java @@ -6,6 +6,7 @@ import gregtech.api.interfaces.ITexture; import gtPlusPlus.api.objects.data.AutoMap; public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPower { + /** * Value between [0 - 9] to describe the Tier of this Machine. */ @@ -24,31 +25,19 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo */ public final ITexture[][][] mTextures; - public GTPP_MTE_TieredMachineBlock( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInvSlotCount, - String aDescription, - ITexture... aTextures) { + public GTPP_MTE_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, + String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); mTier = (byte) Math.max(0, Math.min(aTier, 9)); - mDescriptionArray = aDescription == null ? new String[0] : new String[] {aDescription}; + mDescriptionArray = aDescription == null ? new String[0] : new String[] { aDescription }; mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : ""; // must always be the last call! if (GT.isClientSide()) mTextures = getTextureSet(aTextures); else mTextures = null; } - public GTPP_MTE_TieredMachineBlock( - int aID, - String aName, - String aNameRegional, - int aTier, - int aInvSlotCount, - String[] aDescription, - ITexture... aTextures) { + public GTPP_MTE_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, + String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); mTier = (byte) Math.max(0, Math.min(aTier, 9)); mDescriptionArray = aDescription == null ? new String[0] : aDescription; @@ -59,17 +48,17 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo else mTextures = null; } - public GTPP_MTE_TieredMachineBlock( - String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GTPP_MTE_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String aDescription, + ITexture[][][] aTextures) { super(aName, aInvSlotCount); mTier = (byte) aTier; - mDescriptionArray = aDescription == null ? new String[0] : new String[] {aDescription}; + mDescriptionArray = aDescription == null ? new String[0] : new String[] { aDescription }; mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : ""; mTextures = aTextures; } - public GTPP_MTE_TieredMachineBlock( - String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GTPP_MTE_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String[] aDescription, + ITexture[][][] aTextures) { super(aName, aInvSlotCount); mTier = (byte) aTier; mDescriptionArray = aDescription == null ? new String[0] : aDescription; @@ -105,8 +94,8 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo } /** - * Used Client Side to get a Texture Set for this Block. - * Called after setting the Tier and the Description so that those two are accessible. + * Used Client Side to get a Texture Set for this Block. Called after setting the Tier and the Description so that + * those two are accessible. * * @param aTextures is the optional Array you can give to the Constructor. */ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java index 36185b638b..e2b5d1eafc 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java @@ -1,14 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.CustomMetaTileBase; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { @@ -37,35 +38,40 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { return; } - float tStrength = aExplosionPower < GT_Values.V[0] - ? 1.0F - : (aExplosionPower < GT_Values.V[1] - ? 2.0F - : (aExplosionPower < GT_Values.V[2] - ? 3.0F - : (aExplosionPower < GT_Values.V[3] - ? 4.0F - : (aExplosionPower < GT_Values.V[4] - ? 5.0F - : (aExplosionPower < GT_Values.V[4] * 2L - ? 6.0F - : (aExplosionPower < GT_Values.V[5] - ? 7.0F - : (aExplosionPower < GT_Values.V[6] - ? 8.0F - : (aExplosionPower < GT_Values.V[7] - ? 9.0F - : 10.0F)))))))); + float tStrength = aExplosionPower + < GT_Values.V[0] + ? 1.0F + : (aExplosionPower < GT_Values.V[1] ? 2.0F + : (aExplosionPower < GT_Values.V[2] ? 3.0F + : (aExplosionPower < GT_Values.V[3] ? 4.0F + : (aExplosionPower < GT_Values.V[4] ? 5.0F + : (aExplosionPower < GT_Values.V[4] * 2L ? 6.0F + : (aExplosionPower < GT_Values.V[5] ? 7.0F + : (aExplosionPower < GT_Values.V[6] ? 8.0F + : (aExplosionPower < GT_Values.V[7] + ? 9.0F + : 10.0F)))))))); int tX = this.getBaseMetaTileEntity().getXCoord(); short tY = this.getBaseMetaTileEntity().getYCoord(); int tZ = this.getBaseMetaTileEntity().getZCoord(); World tWorld = this.getBaseMetaTileEntity().getWorld(); GT_Utility.sendSoundToPlayers( - tWorld, (String) GregTe