diff options
Diffstat (limited to 'src/main/java/gregtech/common/tileentities')
113 files changed, 9117 insertions, 5248 deletions
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java index 6fab5d92d6..f5fcda6d7b 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.automation; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_CHESTBUFFER; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_CHESTBUFFER_GLOW; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -9,49 +12,54 @@ import gregtech.common.gui.GT_Container_ChestBuffer; import gregtech.common.gui.GT_GUIContainer_ChestBuffer; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_CHESTBUFFER; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_CHESTBUFFER_GLOW; - public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { - private static final int[] tickRate = {400, 200, 100, 20, 4, 1, 1, 1, 1, 1, 1, 1, 1}; - private static final int[] maxStacks = { 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32, 64, 128}; - + private static final int[] tickRate = {400, 200, 100, 20, 4, 1, 1, 1, 1, 1, 1, 1, 1}; + private static final int[] maxStacks = {1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32, 64, 128}; public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 28, new String[]{ - "Buffers up to 27 Item Stacks", - "Use Screwdriver to regulate output stack size", - "Does not consume energy to move Item", - getTickRateDesc(aTier)}); + super(aID, aName, aNameRegional, aTier, 28, new String[] { + "Buffers up to 27 Item Stacks", + "Use Screwdriver to regulate output stack size", + "Does not consume energy to move Item", + getTickRateDesc(aTier) + }); } - public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { + public GT_MetaTileEntity_ChestBuffer( + int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } - public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription) { - super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); + public GT_MetaTileEntity_ChestBuffer( + int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } - public GT_MetaTileEntity_ChestBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_ChestBuffer( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_ChestBuffer(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_ChestBuffer( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ChestBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_ChestBuffer( + this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } @Override public ITexture getOverlayIcon() { return TextureFactory.of( TextureFactory.of(AUTOMATION_CHESTBUFFER), - TextureFactory.builder().addIcon(AUTOMATION_CHESTBUFFER_GLOW).glow().build()); + TextureFactory.builder() + .addIcon(AUTOMATION_CHESTBUFFER_GLOW) + .glow() + .build()); } @Override @@ -63,13 +71,14 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aTimer % tickRate[mTier] > 0) return; - // mSuccess will be negative if the call is caused by the %200 aTimer, always try to push. Otherwise it will be positive. + // mSuccess will be negative if the call is caused by the %200 aTimer, always try to push. Otherwise it will be + // positive. // For the first 6 ticks after a successful move (49->44), push every tick. Then go to every 5 ticks. - if ( (mSuccess <= 0 ) || (mSuccess > 43) || ((mSuccess % 5) == 0 )){ + if ((mSuccess <= 0) || (mSuccess > 43) || ((mSuccess % 5) == 0)) { super.moveItems(aBaseMetaTileEntity, aTimer, Math.min(MAX, maxStacks[mTier])); } - if(mSuccess < 0) { + if (mSuccess < 0) { mSuccess = 0; } } @@ -84,7 +93,7 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { return new GT_GUIContainer_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity); } - protected static String getTickRateDesc(int tier){ + protected static String getTickRateDesc(int tier) { int tickRate = getTickRate(tier); String timeStr = ""; String numStr = ""; @@ -93,8 +102,7 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { } else { numStr = "1 item"; } - if (tickRate < 20) - timeStr = "1/" + 20/tickRate + " "; + if (tickRate < 20) timeStr = "1/" + 20 / tickRate + " "; else if (tickRate > 20) { timeStr = (tickRate / 20) + "th "; } @@ -102,8 +110,7 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { } protected static int getTickRate(int tier) { - if (tier > 9) - return 1; + if (tier > 9) return 1; return tickRate[tier]; } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java index 02eaf892ac..f3ab391109 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.automation; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_FILTER; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_FILTER_GLOW; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -12,31 +15,32 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_FILTER; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_FILTER_GLOW; - public class GT_MetaTileEntity_Filter extends GT_MetaTileEntity_Buffer { public boolean bIgnoreNBT = false; public boolean bInvertFilter = false; public GT_MetaTileEntity_Filter(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 19, new String[]{ - "Filters up to 9 different Items", - "Use Screwdriver to regulate output stack size", - "Does not consume energy to move Item"}); + super(aID, aName, aNameRegional, aTier, 19, new String[] { + "Filters up to 9 different Items", + "Use Screwdriver to regulate output stack size", + "Does not consume energy to move Item" + }); } - public GT_MetaTileEntity_Filter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Filter( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - - public GT_MetaTileEntity_Filter(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + + public GT_MetaTileEntity_Filter( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Filter(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_Filter( + this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } @Override @@ -96,16 +100,10 @@ public class GT_MetaTileEntity_Filter extends GT_MetaTileEntity_Buffer { if (bRedstoneIfFull) { int emptySlots = 0; for (int i = 0; i < 9; i++) { - if (mInventory[i] == null) - ++emptySlots; + if (mInventory[i] == null) ++emptySlots; } - if (!bInvert) - emptySlots = 9 - emptySlots; - for (byte b = 0; b < 6; b++) - aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b, (byte) emptySlots); - } - else - for (byte b = 0; b < 6; b++) - aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b, (byte) 0); + if (!bInvert) emptySlots = 9 - emptySlots; + for (byte b = 0; b < 6; b++) aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b, (byte) emptySlots); + } else for (byte b = 0; b < 6; b++) aBaseMetaTileEntity.setInternalOutputRedstoneSignal(b, (byte) 0); } } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java index d27d8db04d..4241fa8d11 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.automation; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_ITEMDISTRIBUTOR; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_ITEMDISTRIBUTOR_GLOW; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -15,38 +18,38 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_ITEMDISTRIBUTOR; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_ITEMDISTRIBUTOR_GLOW; - public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer { private byte[] itemsPerSide = new byte[6]; private byte currentSide = 0, currentSideItemCount = 0; public GT_MetaTileEntity_ItemDistributor(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 28, new String[]{ - "Distributes Items between different Machine Sides", - "Default Items per Machine Side: 0", - "Use Screwdriver to increase/decrease Items per Side", - "Does not consume energy to move Item"}); + super(aID, aName, aNameRegional, aTier, 28, new String[] { + "Distributes Items between different Machine Sides", + "Default Items per Machine Side: 0", + "Use Screwdriver to increase/decrease Items per Side", + "Does not consume energy to move Item" + }); } - public GT_MetaTileEntity_ItemDistributor(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, - String aDescription) { + public GT_MetaTileEntity_ItemDistributor( + int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } - public GT_MetaTileEntity_ItemDistributor(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_ItemDistributor( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_ItemDistributor(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_ItemDistributor( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ItemDistributor(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, - this.mTextures); + return new GT_MetaTileEntity_ItemDistributor( + this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } @Override @@ -58,7 +61,10 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer public ITexture getOverlayIcon() { return TextureFactory.of( TextureFactory.of(AUTOMATION_ITEMDISTRIBUTOR), - TextureFactory.builder().addIcon(AUTOMATION_ITEMDISTRIBUTOR_GLOW).glow().build()); + TextureFactory.builder() + .addIcon(AUTOMATION_ITEMDISTRIBUTOR_GLOW) + .glow() + .build()); } @Override @@ -72,7 +78,13 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { return mTextures[0][aColorIndex + 1]; } else { @@ -85,8 +97,8 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer ITexture[][][] returnTextures = new ITexture[2][17][]; ITexture baseIcon = getOverlayIcon(), pipeIcon = TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_OUT); for (int i = 0; i < 17; i++) { - returnTextures[0][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], baseIcon}; - returnTextures[1][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], pipeIcon, baseIcon}; + returnTextures[0][i] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][i], baseIcon}; + returnTextures[1][i] = new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][i], pipeIcon, baseIcon}; } return returnTextures; } @@ -132,9 +144,17 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer return; } } - movedItems = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, adjacentTileEntity, currentSide, - GT_Utility.getOppositeSide(currentSide), null, false, (byte) 64, (byte) 1, - (byte) (itemsPerSide[currentSide] - currentSideItemCount), (byte) 1); + movedItems = GT_Utility.moveOneItemStack( + aBaseMetaTileEntity, + adjacentTileEntity, + currentSide, + GT_Utility.getOppositeSide(currentSide), + null, + false, + (byte) 64, + (byte) 1, + (byte) (itemsPerSide[currentSide] - currentSideItemCount), + (byte) 1); currentSideItemCount += movedItems; if (currentSideItemCount >= itemsPerSide[currentSide]) { currentSide = (byte) ((currentSide + 1) % 6); @@ -148,7 +168,7 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - //Adjust items per side by 1 or -1, constrained to the cyclic interval [0, 127] + // Adjust items per side by 1 or -1, constrained to the cyclic interval [0, 127] itemsPerSide[aSide] += aPlayer.isSneaking() ? -1 : 1; itemsPerSide[aSide] = (byte) ((itemsPerSide[aSide] + 128) % 128); GT_Utility.sendChatToPlayer(aPlayer, GT_Utility.trans("211", "Items per side: ") + itemsPerSide[aSide]); diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_RecipeFilter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_RecipeFilter.java index a2f86103f5..007fa79213 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_RecipeFilter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_RecipeFilter.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.automation; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_RECIPEFILTER; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_RECIPEFILTER_GLOW; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -13,24 +16,24 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_RECIPEFILTER; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_RECIPEFILTER_GLOW; - public class GT_MetaTileEntity_RecipeFilter extends GT_MetaTileEntity_SpecialFilter { public GT_Recipe.GT_Recipe_Map mRecipeMap; public GT_MetaTileEntity_RecipeFilter(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, new String[]{ - "Filters 1 Recipe Type", - "Use Screwdriver to regulate output stack size", - "Does not consume energy to move Item"}); + super(aID, aName, aNameRegional, aTier, new String[] { + "Filters 1 Recipe Type", + "Use Screwdriver to regulate output stack size", + "Does not consume energy to move Item" + }); } - public GT_MetaTileEntity_RecipeFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_RecipeFilter( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_RecipeFilter(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_RecipeFilter( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -59,21 +62,24 @@ public class GT_MetaTileEntity_RecipeFilter extends GT_MetaTileEntity_SpecialFil @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_RecipeFilter(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_RecipeFilter( + this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } @Override public ITexture getOverlayIcon() { return TextureFactory.of( TextureFactory.of(AUTOMATION_RECIPEFILTER), - TextureFactory.builder().addIcon(AUTOMATION_RECIPEFILTER_GLOW).glow().build()); + TextureFactory.builder() + .addIcon(AUTOMATION_RECIPEFILTER_GLOW) + .glow() + .build()); } @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - if (mRecipeMap != null) - aNBT.setString("mRecipeMap", this.mRecipeMap.mUniqueIdentifier); + if (mRecipeMap != null) aNBT.setString("mRecipeMap", this.mRecipeMap.mUniqueIdentifier); } @Override diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java index c20df68b32..edc8ef78e4 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.automation; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_REGULATOR; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_REGULATOR_GLOW; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -8,47 +11,49 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_Regulator; import gregtech.common.gui.GT_GUIContainer_Regulator; +import java.util.Collections; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import java.util.Collections; - -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_REGULATOR; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_REGULATOR_GLOW; - -public class GT_MetaTileEntity_Regulator - extends GT_MetaTileEntity_Buffer { +public class GT_MetaTileEntity_Regulator extends GT_MetaTileEntity_Buffer { public int[] mTargetSlots = {0, 0, 0, 0, 0, 0, 0, 0, 0}; private boolean charge = false, decharge = false; public GT_MetaTileEntity_Regulator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 20, new String[]{ - "Filters up to 9 different Items", - "Allows Item-specific output stack size", - "Allows Item-specific output slot", - "Does not consume energy to move Item"}); + super(aID, aName, aNameRegional, aTier, 20, new String[] { + "Filters up to 9 different Items", + "Allows Item-specific output stack size", + "Allows Item-specific output slot", + "Does not consume energy to move Item" + }); } - public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Regulator( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - - public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + + public GT_MetaTileEntity_Regulator( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Regulator(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_Regulator( + this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } @Override public ITexture getOverlayIcon() { return TextureFactory.of( TextureFactory.of(AUTOMATION_REGULATOR), - TextureFactory.builder().addIcon(AUTOMATION_REGULATOR_GLOW).glow().build()); + TextureFactory.builder() + .addIcon(AUTOMATION_REGULATOR_GLOW) + .glow() + .build()); } @Override @@ -95,15 +100,28 @@ public class GT_MetaTileEntity_Regulator } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - //Regulation per Screwdriver is overridden by GUI regulation. + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + // Regulation per Screwdriver is overridden by GUI regulation. } @Override public void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { for (int i = 0, tCosts; i < 9; i++) { if (this.mInventory[(i + 9)] != null) { - tCosts = GT_Utility.moveOneItemStackIntoSlot(getBaseMetaTileEntity(), getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()), getBaseMetaTileEntity().getBackFacing(), this.mTargetSlots[i], Collections.singletonList(this.mInventory[(i + 9)]), false, (byte) this.mInventory[(i + 9)].stackSize, (byte) this.mInventory[(i + 9)].stackSize, (byte) 64, (byte) 1) * 3; + tCosts = GT_Utility.moveOneItemStackIntoSlot( + getBaseMetaTileEntity(), + getBaseMetaTileEntity() + .getTileEntityAtSide( + getBaseMetaTileEntity().getBackFacing()), + getBaseMetaTileEntity().getBackFacing(), + this.mTargetSlots[i], + Collections.singletonList(this.mInventory[(i + 9)]), + false, + (byte) this.mInventory[(i + 9)].stackSize, + (byte) this.mInventory[(i + 9)].stackSize, + (byte) 64, + (byte) 1) + * 3; if (tCosts > 0) { this.mSuccess = 50; break; @@ -114,7 +132,8 @@ public class GT_MetaTileEntity_Regulator @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)])); + return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) + && (GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)])); } @Override diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java index 7065e70a3e..ffa33f426e 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.automation; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_SUPERBUFFER; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_SUPERBUFFER_GLOW; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -7,44 +10,47 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_SuperBuffer; import gregtech.common.gui.GT_GUIContainer_SuperBuffer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_SUPERBUFFER; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_SUPERBUFFER_GLOW; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_SuperBuffer extends GT_MetaTileEntity_ChestBuffer { public GT_MetaTileEntity_SuperBuffer(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 257, new String[]{ - "Buffers up to 256 Item Stacks", - "Use Screwdriver to regulate output stack size", - "Does not consume energy to move Item", - getTickRateDesc(aTier)}); + super(aID, aName, aNameRegional, aTier, 257, new String[] { + "Buffers up to 256 Item Stacks", + "Use Screwdriver to regulate output stack size", + "Does not consume energy to move Item", + getTickRateDesc(aTier) + }); } - public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_SuperBuffer( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_SuperBuffer( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_SuperBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_SuperBuffer( + this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } @Override public ITexture getOverlayIcon() { return TextureFactory.of( TextureFactory.of(AUTOMATION_SUPERBUFFER), - TextureFactory.builder().addIcon(AUTOMATION_SUPERBUFFER_GLOW).glow().build()); + TextureFactory.builder() + .addIcon(AUTOMATION_SUPERBUFFER_GLOW) + .glow() + .build()); } @Override @@ -53,23 +59,20 @@ public class GT_MetaTileEntity_SuperBuffer extends GT_MetaTileEntity_ChestBuffer HashMap<GT_Utility.ItemId, Integer> slots = new HashMap<>(mInventory.length); HashMap<GT_Utility.ItemId, ItemStack> stacks = new HashMap<>(mInventory.length); List<Integer> validSlots = new ArrayList<>(mInventory.length); - //List<String> order = new ArrayList<>(mInventory.length); + // List<String> order = new ArrayList<>(mInventory.length); for (int i = 0; i < mInventory.length - 1; i++) { - if (!isValidSlot(i)) - continue; + if (!isValidSlot(i)) continue; validSlots.add(i); ItemStack s = mInventory[i]; - if(s == null) - continue; + if (s == null) continue; GT_Utility.ItemId sID = GT_Utility.ItemId.createNoCopy(s); slots.merge(sID, s.stackSize, Integer::sum); - if(!stacks.containsKey(sID)) - stacks.put(sID, s); - //order.add(sID); + if (!stacks.containsKey(sID)) stacks.put(sID, s); + // order.add(sID); mInventory[i] = null; } int i = 0; - for(Map.Entry<GT_Utility.ItemId, Integer> entry : slots.entrySet()){ + for (Map.Entry<GT_Utility.ItemId, Integer> entry : slots.entrySet()) { do { int slot = validSlots.get(i); mInventory[slot] = stacks.get(entry.getKey()).copy(); @@ -77,8 +80,7 @@ public class GT_MetaTileEntity_SuperBuffer extends GT_MetaTileEntity_ChestBuffer mInventory[slot].stackSize = toSet; entry.setValue(entry.getValue() - toSet); i++; - } - while(entry.getValue() > 0); + } while (entry.getValue() > 0); } } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java index 95b11bcb54..da1ca6d42a 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java @@ -1,5 +1,9 @@ package gregtech.common.tileentities.automation; +import static gregtech.api.enums.GT_Values.W; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_TYPEFILTER; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_TYPEFILTER_GLOW; + import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -12,39 +16,42 @@ import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import static gregtech.api.enums.GT_Values.W; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_TYPEFILTER; -import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_TYPEFILTER_GLOW; - public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_SpecialFilter { public int mRotationIndex = 0; public OrePrefixes mPrefix = OrePrefixes.ore; public GT_MetaTileEntity_TypeFilter(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, new String[]{ - "Filters 1 Item Type", - "Use Screwdriver to regulate output stack size", - "Does not consume energy to move Item"}); + super(aID, aName, aNameRegional, aTier, new String[] { + "Filters 1 Item Type", + "Use Screwdriver to regulate output stack size", + "Does not consume energy to move Item" + }); } - public GT_MetaTileEntity_TypeFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_TypeFilter( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_TypeFilter(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_TypeFilter( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TypeFilter(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_TypeFilter( + this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } @Override public ITexture getOverlayIcon() { return TextureFactory.of( TextureFactory.of(AUTOMATION_TYPEFILTER), - TextureFactory.builder().addIcon(AUTOMATION_TYPEFILTER_GLOW).glow().build()); + TextureFactory.builder() + .addIcon(AUTOMATION_TYPEFILTER_GLOW) + .glow() + .build()); } public void clickTypeIcon(boolean aRightClick, ItemStack aHandStack) { @@ -73,7 +80,8 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_SpecialFilte } } while (OrePrefixes.values()[i].mPrefixedItems.isEmpty()); } - if (!OrePrefixes.values()[i].mPrefixedItems.isEmpty() && OrePrefixes.values()[i].mPrefixInto == OrePrefixes.values()[i]) + if (!OrePrefixes.values()[i].mPrefixedItems.isEmpty() + && OrePrefixes.values()[i].mPrefixInto == OrePrefixes.values()[i]) mPrefix = OrePrefixes.values()[i]; } } @@ -90,7 +98,10 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_SpecialFilte this.mInventory[SPECIAL_SLOT_INDEX] = null; return; } - this.mInventory[SPECIAL_SLOT_INDEX] = GT_Utility.copyAmount(1L, this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size())); + this.mInventory[SPECIAL_SLOT_INDEX] = GT_Utility.copyAmount( + 1L, + this.mPrefix.mPrefixedItems.get( + this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size())); if (this.mInventory[SPECIAL_SLOT_INDEX] == null) return; if (this.mInventory[SPECIAL_SLOT_INDEX].getItemDamage() == W) this.mInventory[9].setItemDamage(0); this.mInventory[SPECIAL_SLOT_INDEX].setStackDisplayName(this.mPrefix.toString()); @@ -115,19 +126,19 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_SpecialFilte ItemData tData = GT_OreDictUnificator.getItemData(aStack); if (tData != null && tData.mPrefix != null) { OrePrefixes tFix = tData.mPrefix; - if (tFix == OrePrefixes.oreBlackgranite || - tFix == OrePrefixes.oreDense || - tFix == OrePrefixes.oreEnd || - tFix == OrePrefixes.oreEndstone || - tFix == OrePrefixes.oreNether || - tFix == OrePrefixes.oreNetherrack || - tFix == OrePrefixes.oreNormal || - tFix == OrePrefixes.orePoor || - tFix == OrePrefixes.oreRedgranite || - tFix == OrePrefixes.oreRich || - tFix == OrePrefixes.oreSmall || - tFix == OrePrefixes.oreBasalt || - tFix == OrePrefixes.oreMarble) tAllowPrefix = true; + if (tFix == OrePrefixes.oreBlackgranite + || tFix == OrePrefixes.oreDense + || tFix == OrePrefixes.oreEnd + || tFix == OrePrefixes.oreEndstone + || tFix == OrePrefixes.oreNether + || tFix == OrePrefixes.oreNetherrack + || tFix == OrePrefixes.oreNormal + || tFix == OrePrefixes.orePoor + || tFix == OrePrefixes.oreRedgranite + || tFix == OrePrefixes.oreRich + || tFix == OrePrefixes.oreSmall + || tFix == OrePrefixes.oreBasalt + || tFix == OrePrefixes.oreMarble) tAllowPrefix = true; } } return tAllowPrefix; diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java index 9eebaaabc4..9d832e134c 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java @@ -1,10 +1,12 @@ package gregtech.common.tileentities.boilers; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.ParticleFX; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; +import gregtech.api.enums.ParticleFX; import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -23,8 +25,6 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTank { public static final byte SOUND_EVENT_LET_OFF_EXCESS_STEAM = 1; public int mTemperature = 20; @@ -34,11 +34,13 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa public boolean mHadNoWater = false; private int mExcessWater = 0; - public GT_MetaTileEntity_Boiler(int aID, String aName, String aNameRegional, String aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_Boiler( + int aID, String aName, String aNameRegional, String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures); } - public GT_MetaTileEntity_Boiler(int aID, String aName, String aNameRegional, String[] aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_Boiler( + int aID, String aName, String aNameRegional, String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures); } @@ -51,10 +53,17 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - ITexture[] tmp = mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte) (aActive ? 4 : 3)) : aSide][aColorIndex + 1]; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + ITexture[] tmp = + mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte) (aActive ? 4 : 3)) : aSide][aColorIndex + 1]; if (aSide != aFacing && tmp.length == 2) { - tmp = new ITexture[]{tmp[0]}; + tmp = new ITexture[] {tmp[0]}; } return tmp; } @@ -252,7 +261,9 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa } private void calculateHeatUp(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if ((this.mTemperature < getMaxTemperature()) && (this.mProcessingEnergy > 0) && (aTick % getHeatUpRate() == 0L)) { + if ((this.mTemperature < getMaxTemperature()) + && (this.mProcessingEnergy > 0) + && (aTick % getHeatUpRate() == 0L)) { this.mProcessingEnergy -= getEnergyConsumption(); this.mTemperature += getHeatUpAmount(); } @@ -300,11 +311,16 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa protected final void pushSteamToSide(IGregTechTileEntity aBaseMetaTileEntity, int aSide) { IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide((byte) aSide); if (tTileEntity == null) return; - FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(aSide), Math.max(1, this.mSteam.amount / 2), false); + FluidStack tDrained = aBaseMetaTileEntity.drain( + ForgeDirection.getOrientation(aSide), Math.max(1, this.mSteam.amount / 2), false); if (tDrained == null) return; - int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tDrained, false); + int tFilledAmount = + tTileEntity.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tDrained, false); if (tFilledAmount <= 0) return; - tTileEntity.fill(ForgeDirection.getOrientation(aSide).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(aSide), tFilledAmount, true), true); + tTileEntity.fill( + ForgeDirection.getOrientation(aSide).getOpposite(), + aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(aSide), tFilledAmount, true), + true); } protected void pushSteamToInventories(IGregTechTileEntity aBaseMetaTileEntity) { @@ -328,7 +344,6 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return GT_Mod.gregtechproxy.mAllowSmallBoilerAutomation; - } @Override @@ -341,7 +356,13 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa if (aIndex == GT_MetaTileEntity_Boiler.SOUND_EVENT_LET_OFF_EXCESS_STEAM) { GT_Utility.doSoundAtClient(SoundResource.RANDOM_FIZZ, 2, 1.0F, aX, aY, aZ); - new ParticleEventBuilder().setIdentifier(ParticleFX.CLOUD).setWorld(getBaseMetaTileEntity().getWorld()).setMotion(0D, 0D, 0D).<ParticleEventBuilder>times(8, x -> x.setPosition(aX - 0.5D + XSTR_INSTANCE.nextFloat(), aY, aZ - 0.5D + XSTR_INSTANCE.nextFloat()).run()); + new ParticleEventBuilder() + .setIdentifier(ParticleFX.CLOUD) + .setWorld(getBaseMetaTileEntity().getWorld()) + .setMotion(0D, 0D, 0D) + .<ParticleEventBuilder>times(8, x -> x.setPosition( + aX - 0.5D + XSTR_INSTANCE.nextFloat(), aY, aZ - 0.5D + XSTR_INSTANCE.nextFloat()) + .run()); } } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java index 4b4a0299c1..9d3c61fc82 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java @@ -1,11 +1,21 @@ package gregtech.common.tileentities.boilers; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; -import gregtech.api.enums.ParticleFX; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.ParticleFX; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -22,22 +32,13 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraftforge.common.util.ForgeDirection; -import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT; -import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { public GT_MetaTileEntity_Boiler_Bronze(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, new String[]{ - "An early way to get Steam Power", - "Produces 120L of Steam per second", - "Causes " + GT_Mod.gregtechproxy.mPollutionSmallCoalBoilerPerSecond + " Pollution per second"}); + super(aID, aName, aNameRegional, new String[] { + "An early way to get Steam Power", + "Produces 120L of Steam per second", + "Causes " + GT_Mod.gregtechproxy.mPollutionSmallCoalBoilerPerSecond + " Pollution per second" + }); } public GT_MetaTileEntity_Boiler_Bronze(int aID, String aName, String aNameRegional, String[] aDescription) { @@ -55,17 +56,27 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[5][17][]; - final ITexture[] - texBottom = {TextureFactory.of(MACHINE_BRONZEBRICKS_BOTTOM)}, + final ITexture[] texBottom = {TextureFactory.of(MACHINE_BRONZEBRICKS_BOTTOM)}, texTop = {TextureFactory.of(MACHINE_BRONZEBRICKS_TOP), TextureFactory.of(OVERLAY_PIPE)}, texSide = {TextureFactory.of(MACHINE_BRONZEBRICKS_SIDE), TextureFactory.of(OVERLAY_PIPE)}, - texFront = {TextureFactory.of(MACHINE_BRONZEBRICKS_SIDE), - TextureFactory.of(BOILER_FRONT), - TextureFactory.builder().addIcon(BOILER_FRONT_GLOW).glow().build()}, - texFrontActive = { - TextureFactory.of(MACHINE_BRONZEBRICKS_SIDE), - TextureFactory.of(BOILER_FRONT_ACTIVE), - TextureFactory.builder().addIcon(BOILER_FRONT_ACTIVE_GLOW).glow().build()}; + texFront = + { + TextureFactory.of(MACHINE_BRONZEBRICKS_SIDE), + TextureFactory.of(BOILER_FRONT), + TextureFactory.builder() + .addIcon(BOILER_FRONT_GLOW) + .glow() + .build() + }, + texFrontActive = + { + TextureFactory.of(MACHINE_BRONZEBRICKS_SIDE), + TextureFactory.of(BOILER_FRONT_ACTIVE), + TextureFactory.builder() + .addIcon(BOILER_FRONT_ACTIVE_GLOW) + .glow() + .build() + }; for (int i = 0; i < 17; i++) { rTextures[0][i] = texBottom; rTextures[1][i] = texTop; @@ -109,8 +120,8 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { final byte frontFacing = aBaseMetaTileEntity.getFrontFacing(); if (frontFacing > 1 - && aBaseMetaTileEntity.getCoverIDAtSide(frontFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(frontFacing)) { + && aBaseMetaTileEntity.getCoverIDAtSide(frontFacing) == 0 + && !aBaseMetaTileEntity.getOpacityAtSide(frontFacing)) { final double oX = aBaseMetaTileEntity.getOffsetX(frontFacing, 1) + 8D / 16D; final double oY = aBaseMetaTileEntity.getOffsetY(frontFacing, 1); @@ -137,8 +148,7 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { z = oZ + offset; } - ParticleEventBuilder particleEventBuilder = - (new ParticleEventBuilder()) + ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder()) .setMotion(0D, 0D, 0D) .setPosition(x, y, z) .setWorld(getBaseMetaTileEntity().getWorld()); @@ -151,7 +161,10 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L) && this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) { + if ((aBaseMetaTileEntity.isServerSide()) + && (aTick > 20L) + && this.mProcessingEnergy > 0 + && (aTick % 20L == 0L)) { GT_Pollution.addPollution(getBaseMetaTileEntity(), getPollution()); } } @@ -184,64 +197,125 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { @Override protected void updateFuel(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (this.mInventory[2] == null) return; - if ( - (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) || - (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Charcoal) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) || - (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) || - (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Diamond) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) || - GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke") || - GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCactusCharcoal") || - GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCactusCoke") || - GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelSugarCharcoal") || - GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelSugarCoke") - ) { - if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10) > 0) { - this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10); + if ((GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Coal) + && !GT_Utility.isPartOfOrePrefix(this.mInventory[2], OrePrefixes.block)) + || (GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Charcoal) + && !GT_Utility.isPartOfOrePrefix(this.mInventory[2], OrePrefixes.block)) + || (GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Lignite) + && !GT_Utility.isPartOfOrePrefix(this.mInventory[2], OrePrefixes.block)) + || (GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Diamond) + && !GT_Utility.isPartOfOrePrefix(this.mInventory[2], OrePrefixes.block)) + || GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke") + || GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCactusCharcoal") + || GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCactusCoke") + || GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelSugarCharcoal") + || GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelSugarCoke")) { + if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2]) / 10) > 0) { + this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) / 10); aBaseMetaTileEntity.decrStackSize(2, 1); - if (XSTR.XSTR_INSTANCE.nextInt(GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal) || GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Charcoal) ? 3 : GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) ? 8 : 2 ) == 0) { - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) || GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal)) ? Materials.DarkAsh : Materials.Ash, 1L)); + if (XSTR.XSTR_INSTANCE.nextInt( + GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Coal) + || GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Charcoal) + ? 3 + : GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Lignite) ? 8 : 2) + == 0) { + aBaseMetaTileEntity.addStackToSlot( + 3, + GT_OreDictUnificator.get( + OrePrefixes.dustTiny, + (GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Lignite) + || GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Coal)) + ? Materials.DarkAsh + : Materials.Ash, + 1L)); } } - } - else if ( - //If its a block of the following materials - GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Coal)) || - GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Lignite)) || - GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Charcoal))|| - GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Diamond)) || - - //if its either a Railcraft Coke Block or a custom GTNH compressed Coal/charcoal/lignite/coke block - ( - Block.getBlockFromItem(this.mInventory[2].getItem()) != null && //check if the block exists - ( - Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("tile") && //check if the block is a tile -> block - ( - //If the name of the block contains these names - Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("charcoal") || - Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("coal") || - Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("diamond") || - Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("coke") || - Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("railcraft.cube") || - Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("lignite") - ) - ) - ) - ){ - //try to add 10% of the burnvalue as Processing energy, no boost for coal coke here - if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10) > 0) { + } else if ( + // If its a block of the following materials + GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.block.get(Materials.Coal)) + || GT_OreDictUnificator.isItemStackInstanceOf( + this.mInventory[2], OrePrefixes.block.get(Materials.Lignite)) + || GT_OreDictUnificator.isItemStackInstanceOf( + this.mInventory[2], OrePrefixes.block.get(Materials.Charcoal)) + || GT_OreDictUnificator.isItemStackInstanceOf( + this.mInventory[2], OrePrefixes.block.get(Materials.Diamond)) + || + + // if its either a Railcraft Coke Block or a custom GTNH compressed Coal/charcoal/lignite/coke block + (Block.getBlockFromItem(this.mInventory[2].getItem()) != null + && // check if the block exists + (Block.getBlockFromItem(this.mInventory[2].getItem()) + .getUnlocalizedName() + .toLowerCase() + .contains("tile") + && // check if the block is a tile -> block + ( + // If the name of the block contains these names + Block.getBlockFromItem(this.mInventory[2].getItem()) + .getUnlocalizedName() + .toLowerCase() + .contains("charcoal") + || Block.getBlockFromItem(this.mInventory[2].getItem()) + .getUnlocalizedName() + .toLowerCase() + .contains("coal") + || Block.getBlockFromItem(this.mInventory[2].getItem()) + .getUnlocalizedName() + .toLowerCase() + .contains("diamond") + || Block.getBlockFromItem(this.mInventory[2].getItem()) + .getUnlocalizedName() + .toLowerCase() + .contains("coke") + || Block.getBlockFromItem(this.mInventory[2].getItem()) + .getUnlocalizedName() + .toLowerCase() + .contains("railcraft.cube") + || Block.getBlockFromItem(this.mInventory[2].getItem()) + .getUnlocalizedName() + .toLowerCase() + .contains("lignite"))))) { + // try to add 10% of the burnvalue as Processing energy, no boost for coal coke here + if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2]) / 10) > 0) { this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) / 10); aBaseMetaTileEntity.decrStackSize(2, 1); - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dust, (GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) || GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Coal) || Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("coal") || Block.getBlockFromItem(this.mInventory[2].getItem()).getUnlocalizedName().toLowerCase().contains("lignite") ) ? Materials.DarkAsh : Materials.Ash, 1L)); + aBaseMetaTileEntity.addStackToSlot( + 3, + GT_OreDictUnificator.get( + OrePrefixes.dust, + (GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Lignite) + || GT_Utility.isPartOfMaterials(this.mInventory[2], Materials.Coal) + || Block.getBlockFromItem(this.mInventory[2].getItem()) + .getUnlocalizedName() + .toLowerCase() + .contains("coal") + || Block.getBlockFromItem(this.mInventory[2].getItem()) + .getUnlocalizedName() + .toLowerCase() + .contains("lignite")) + ? Materials.DarkAsh + : Materials.Ash, + 1L)); } - //enables every other fuel with at least 2000 burntime as a fuel, i.e. peat, Magic/Solid Super Fuel, Coal Singularities, Nitor, while bucket of creosite should be blocked same goes for lava - }else if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])) >= 2000 && !(this.mInventory[2].getUnlocalizedName().toLowerCase().contains("bucket") || this.mInventory[2].getUnlocalizedName().toLowerCase().contains("cell"))){ + // enables every other fuel with at least 2000 burntime as a fuel, i.e. peat, Magic/Solid Super Fuel, Coal + // Singularities, Nitor, while bucket of creosite should be blocked same goes for lava + } else if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])) >= 2000 + && !(this.mInventory[2].getUnlocalizedName().toLowerCase().contains("bucket") + || this.mInventory[2].getUnlocalizedName().toLowerCase().contains("cell"))) { this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) / 10); aBaseMetaTileEntity.decrStackSize(2, 1); - //adds tiny pile of ash for burntime under 10k, small pile for under 100k and pile for bigger values + // adds tiny pile of ash for burntime under 10k, small pile for under 100k and pile for bigger values if (XSTR.XSTR_INSTANCE.nextInt(2) == 0) - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get( (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) >= 10000 ? TileEntityFurnace.getItemBurnTime(this.mInventory[2]) >= 100000 ? OrePrefixes.dust : OrePrefixes.dustSmall : OrePrefixes.dustTiny), Materials.Ash, 1L)); + aBaseMetaTileEntity.addStackToSlot( + 3, + GT_OreDictUnificator.get( + (TileEntityFurnace.getItemBurnTime(this.mInventory[2]) >= 10000 + ? TileEntityFurnace.getItemBurnTime(this.mInventory[2]) >= 100000 + ? OrePrefixes.dust + : OrePrefixes.dustSmall + : OrePrefixes.dustTiny), + Materials.Ash, + 1L)); } - } - } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java index 18010c0886..38bef79f38 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java @@ -1,5 +1,14 @@ package gregtech.common.tileentities.boilers; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_TOP; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE; + import gregtech.GT_Mod; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -14,15 +23,6 @@ import gregtech.common.gui.GT_GUIContainer_Boiler; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fluids.FluidStack; -import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT; -import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_TOP; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE; - public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { public static final int COOLDOWN_INTERVAL = 20; @@ -31,11 +31,14 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { public static final int PRODUCTION_PER_SECOND = 600; public GT_MetaTileEntity_Boiler_Lava(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, new String[]{ - "A Boiler running off Lava", - "Produces " + PRODUCTION_PER_SECOND + "L of Steam per second", - "Causes " + Integer.toString(GT_Mod.gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond) + " Pollution per second", - "Consumes " + ((double) CONSUMPTION_PER_HEATUP / ENERGY_PER_LAVA) + "L of Lava every " + COOLDOWN_INTERVAL + " ticks when fully heat up"}); + super(aID, aName, aNameRegional, new String[] { + "A Boiler running off Lava", + "Produces " + PRODUCTION_PER_SECOND + "L of Steam per second", + "Causes " + Integer.toString(GT_Mod.gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond) + + " Pollution per second", + "Consumes " + ((double) CONSUMPTION_PER_HEATUP / ENERGY_PER_LAVA) + "L of Lava every " + COOLDOWN_INTERVAL + + " ticks when fully heat up" + }); } public GT_MetaTileEntity_Boiler_Lava(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -49,18 +52,24 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[5][17][]; - final ITexture[] - texBottom = {TextureFactory.of(MACHINE_STEELBRICKS_BOTTOM)}, + final ITexture[] texBottom = {TextureFactory.of(MACHINE_STEELBRICKS_BOTTOM)}, texTop = {TextureFactory.of(MACHINE_STEELBRICKS_TOP), TextureFactory.of(OVERLAY_PIPE)}, texSide = {TextureFactory.of(MACHINE_STEELBRICKS_SIDE), TextureFactory.of(OVERLAY_PIPE)}, - texFront = { - TextureFactory.of(MACHINE_STEELBRICKS_SIDE), - TextureFactory.of(BOILER_LAVA_FRONT), - TextureFactory.of(BOILER_LAVA_FRONT_GLOW)}, - texFrontActive = { - TextureFactory.of(MACHINE_STEELBRICKS_SIDE), - TextureFactory.of(BOILER_LAVA_FRONT_ACTIVE), - TextureFactory.builder().addIcon(BOILER_LAVA_FRONT_ACTIVE_GLOW).glow().build()}; + texFront = + { + TextureFactory.of(MACHINE_STEELBRICKS_SIDE), + TextureFactory.of(BOILER_LAVA_FRONT), + TextureFactory.of(BOILER_LAVA_FRONT_GLOW) + }, + texFrontActive = + { + TextureFactory.of(MACHINE_STEELBRICKS_SIDE), + TextureFactory.of(BOILER_LAVA_FRONT_ACTIVE), + TextureFactory.builder() + .addIcon(BOILER_LAVA_FRONT_ACTIVE_GLOW) + .glow() + .build() + }; for (byte i = 0; i < 17; i++) { rTextures[0][i] = texBottom; rTextures[1][i] = texTop; @@ -127,7 +136,8 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { this.mProcessingEnergy += 1000 * ENERGY_PER_LAVA; aBaseMetaTileEntity.decrStackSize(2, 1); aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Empty, 1L)); - } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.bucketClay.get(Materials.Lava))) { + } else if (GT_OreDictUnificator.isItemStackInstanceOf( + this.mInventory[2], OrePrefixes.bucketClay.get(Materials.Lava))) { this.mProcessingEnergy += 1000 * ENERGY_PER_LAVA; aBaseMetaTileEntity.decrStackSize(2, 1); // Clay lava buckets break, so you don't get it back. diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java index cd3bb00ee4..cccfb1b6b4 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java @@ -1,5 +1,10 @@ package gregtech.common.tileentities.boilers; +import static gregtech.api.GregTech_API.sMachineFile; +import static gregtech.api.enums.ConfigCategories.machineconfig; +import static mcp.mobius.waila.api.SpecialChars.GOLD; +import static mcp.mobius.waila.api.SpecialChars.RESET; + import gregtech.api.enums.Dyes; import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; @@ -11,6 +16,7 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_Boiler; import gregtech.common.gui.GT_GUIContainer_Boiler; +import java.util.List; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.entity.player.EntityPlayerMP; @@ -22,21 +28,13 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.List; - -import static gregtech.api.GregTech_API.sMachineFile; -import static gregtech.api.enums.ConfigCategories.machineconfig; -import static mcp.mobius.waila.api.SpecialChars.GOLD; -import static mcp.mobius.waila.api.SpecialChars.RESET; - public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { public static final String LPS_FMT = "%s L/s"; private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization( "gt.blockmachines.boiler.solar.desc.format", - "Steam Power by the Sun%n" + - "Produces %sL of Steam per second%n" + - "Calcifies over time, reducing Steam output to %sL/s%n" + - "Break and replace to descale"); + "Steam Power by the Sun%n" + "Produces %sL of Steam per second%n" + + "Calcifies over time, reducing Steam output to %sL/s%n" + + "Break and replace to descale"); protected final Config mConfig; protected int basicTemperatureMod = 5; // Base Celsius gain or loss private int mRunTimeTicks = 0; @@ -56,13 +54,14 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { mConfig = createConfig(); } - protected GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, Config aConfig) { + protected GT_MetaTileEntity_Boiler_Solar( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, Config aConfig) { super(aName, aTier, aDescription, aTextures); mConfig = aConfig; } protected Config createConfig() { - return new Config(machineconfig + ".boiler.solar.bronze",1080000,40,120,45); + return new Config(machineconfig + ".boiler.solar.bronze", 1080000, 40, 120, 45); } /** @@ -92,9 +91,10 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { @Override public String[] getDescription() { - return String.format(localizedDescFormat, - GT_Utility.formatNumbers(getMaxOutputPerSecond()), - GT_Utility.formatNumbers(getMinOutputPerSecond())) + return String.format( + localizedDescFormat, + GT_Utility.formatNumbers(getMaxOutputPerSecond()), + GT_Utility.formatNumbers(getMinOutputPerSecond())) .split("\\R"); } @@ -108,16 +108,17 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { for (int color = -1; color < 16; color++) { int i = color + 1; short[] colorModulation = Dyes.getModulation(color, Dyes._NULL.mRGBa); - rTextures[0][i] = new ITexture[]{ - TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, colorModulation)}; - rTextures[1][i] = new ITexture[]{ - TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_TOP, colorModulation), - TextureFactory.of(BlockIcons.BOILER_SOLAR)}; - rTextures[2][i] = new ITexture[]{ - TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_SIDE, colorModulation)}; - rTextures[3][i] = new ITexture[]{ - TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_SIDE, colorModulation), - TextureFactory.of(BlockIcons.OVERLAY_PIPE)}; + rTextures[0][i] = + new ITexture[] {TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, colorModulation)}; + rTextures[1][i] = new ITexture[] { + TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_TOP, colorModulation), + TextureFactory.of(BlockIcons.BOILER_SOLAR) + }; + rTextures[2][i] = new ITexture[] {TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_SIDE, colorModulation)}; + rTextures[3][i] = new ITexture[] { + TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_SIDE, colorModulation), + TextureFactory.of(BlockIcons.OVERLAY_PIPE) + }; } return rTextures; } @@ -133,7 +134,13 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { int i = aColorIndex + 1; if (aSide >= 2) { if (aSide != aFacing) return mTextures[2][i]; @@ -193,7 +200,9 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { * from the maximum output per second, and return this or the minimum output per second */ return mConfig.getMaxOutputPerSecond() - - mConfig.getMaxOutputPerSecond() * (mRunTimeTicks - mConfig.getCalcificationTicks()) / mConfig.getCalcificationTicks(); + - mConfig.getMaxOutputPerSecond() + * (mRunTimeTicks - mConfig.getCalcificationTicks()) + / mConfig.getCalcificationTicks(); } else { return mConfig.getMaxOutputPerSecond(); } @@ -251,16 +260,19 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { @Override public String[] getInfoData() { - return String.format("Heat Capacity: " + EnumChatFormatting.GREEN + "%s %%" + EnumChatFormatting.RESET + - " Hot time: " + EnumChatFormatting.RED + "%s s" + EnumChatFormatting.RESET + "%n" + - "Min output: " + EnumChatFormatting.RED + LPS_FMT + EnumChatFormatting.RESET + - " Max output: " + EnumChatFormatting.RED + LPS_FMT + EnumChatFormatting.RESET + "%n" + - "Current Output: " + EnumChatFormatting.YELLOW + LPS_FMT + EnumChatFormatting.RESET, - GT_Utility.formatNumbers(getHeatCapacityPercent()), - GT_Utility.formatNumbers(getHotTimeSeconds()), - GT_Utility.formatNumbers(getMinOutputPerSecond()), - GT_Utility.formatNumbers(getMaxOutputPerSecond()), - GT_Utility.formatNumbers(getProductionPerSecond())) + return String.format( + "Heat Capacity: " + EnumChatFormatting.GREEN + "%s %%" + EnumChatFormatting.RESET + + " Hot time: " + + EnumChatFormatting.RED + "%s s" + EnumChatFormatting.RESET + "%n" + "Min output: " + + EnumChatFormatting.RED + LPS_FMT + EnumChatFormatting.RESET + " Max output: " + + EnumChatFormatting.RED + LPS_FMT + EnumChatFormatting.RESET + "%n" + + "Current Output: " + + EnumChatFormatting.YELLOW + LPS_FMT + EnumChatFormatting.RESET, + GT_Utility.formatNumbers(getHeatCapacityPercent()), + GT_Utility.formatNumbers(getHotTimeSeconds()), + GT_Utility.formatNumbers(getMinOutputPerSecond()), + GT_Utility.formatNumbers(getMaxOutputPerSecond()), + GT_Utility.formatNumbers(getProductionPerSecond())) .split("\\R"); } @@ -278,15 +290,20 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { } @Override - public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public void getWailaBody( + ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); - currentTip.add(String.format((GOLD + "Solar Boiler Output: " + RESET + "%d/%d L/s"), tag.getInteger("calcificationOutput"), tag.getInteger("maxCalcificationOutput"))); + currentTip.add(String.format( + (GOLD + "Solar Boiler Output: " + RESET + "%d/%d L/s"), + tag.getInteger("calcificationOutput"), + tag.getInteger("maxCalcificationOutput"))); super.getWailaBody(itemStack, currentTip, accessor, config); } @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { + public void getWailaNBTData( + EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setInteger("calcificationOutput", (getProductionPerSecond())); tag.setInteger("maxCalcificationOutput", (getMaxOutputPerSecond())); @@ -299,27 +316,38 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { private final int coolDownTicks; private final int maxRuntimeTicks; - public Config(String aCategory, - int aDefaultCalcificationTicks, - int aDefaultMinOutputPerSecond, - int aDefaultMaxOutputPerSecond, - int aDefaultCoolDownTicks) { - calcificationTicks = get(aCategory,"CalcificationTicks", aDefaultCalcificationTicks, + public Config( + String aCategory, + int aDefaultCalcificationTicks, + int aDefaultMinOutputPerSecond, + int aDefaultMaxOutputPerSecond, + int aDefaultCoolDownTicks) { + calcificationTicks = get( + aCategory, + "CalcificationTicks", + aDefaultCalcificationTicks, "Number of run-time ticks before boiler starts calcification.", "100% calcification and minimal output will be reached at 2 times this."); - minOutputPerSecond = get(aCategory,"MinOutputPerSecond", aDefaultMinOutputPerSecond); - maxOutputPerSecond = get(aCategory,"MaxOutputPerSecond", aDefaultMaxOutputPerSecond); - coolDownTicks = get(aCategory,"CoolDownTicks", aDefaultCoolDownTicks, "Number of ticks it takes to lose 1°C."); + minOutputPerSecond = get(aCategory, "MinOutputPerSecond", aDefaultMinOutputPerSecond); + maxOutputPerSecond = get(aCategory, "MaxOutputPerSecond", aDefaultMaxOutputPerSecond); + coolDownTicks = + get(aCategory, "CoolDownTicks", aDefaultCoolDownTicks, "Number of ticks it takes to lose 1°C."); // After which min output is reached. - maxRuntimeTicks = (getMaxOutputPerSecond() - getMinOutputPerSecond()) * getCalcificationTicks() / getMaxOutputPerSecond() + getCalcificationTicks(); + maxRuntimeTicks = (getMaxOutputPerSecond() - getMinOutputPerSecond()) + * getCalcificationTicks() + / getMaxOutputPerSecond() + + getCalcificationTicks(); } - protected int get(final String aCategory, final String aKey, final int aDefaultValue, final String... aComments) { + protected int get( + final String aCategory, final String aKey, final int aDefaultValue, final String... aComments) { final StringBuilder tCommentBuilder = new StringBuilder(); - for (String tComment: aComments) - tCommentBuilder.append(tComment).append('\n'); + for (String tComment : aComments) tCommentBuilder.append(tComment).append('\n'); tCommentBuilder.append("Default: ").append(aDefaultValue); - return sMachineFile.mConfig.get(aCategory, aKey, aDefaultValue, tCommentBuilder.toString()).getInt(); + return sMachineFile + .mConfig + .get(aCategory, aKey, aDefaultValue, tCommentBuilder.toString()) + .getInt(); } public int getCalcificationTicks() { diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java index e044b6fb9b..223c280ad4 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.boilers; +import static gregtech.api.enums.ConfigCategories.machineconfig; + import gregtech.api.enums.Dyes; import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; @@ -9,22 +11,23 @@ import gregtech.api.render.TextureFactory; import gregtech.common.gui.GT_GUIContainer_Boiler; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.ConfigCategories.machineconfig; - public class GT_MetaTileEntity_Boiler_Solar_Steel extends GT_MetaTileEntity_Boiler_Solar { public GT_MetaTileEntity_Boiler_Solar_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } - public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Boiler_Solar_Steel( + String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } - public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Boiler_Solar_Steel( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } - public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, Config aConfig) { + public GT_MetaTileEntity_Boiler_Solar_Steel( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, Config aConfig) { super(aName, aTier, aDescription, aTextures, aConfig); } @@ -40,16 +43,17 @@ public class GT_MetaTileEntity_Boiler_Solar_Steel extends GT_MetaTileEntity_Boil for (int color = -1; color < 16; color++) { int i = color + 1; short[] colorModulation = Dyes.getModulation(color, Dyes._NULL.mRGBa); - rTextures[0][i] = new ITexture[]{ - TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_BOTTOM, colorModulation)}; - rTextures[1][i] = new ITexture[]{ - TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_TOP, colorModulation), - TextureFactory.of(BlockIcons.BOILER_SOLAR)}; - rTextures[2][i] = new ITexture[]{ - TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_SIDE, colorModulation)}; - rTextures[3][i] = new ITexture[]{ - TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_SIDE, colorModulation), - TextureFactory.of(BlockIcons.OVERLAY_PIPE)}; + rTextures[0][i] = + new ITexture[] {TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_BOTTOM, colorModulation)}; + rTextures[1][i] = new ITexture[] { + TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_TOP, colorModulation), + TextureFactory.of(BlockIcons.BOILER_SOLAR) + }; + rTextures[2][i] = new ITexture[] {TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_SIDE, colorModulation)}; + rTextures[3][i] = new ITexture[] { + TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_SIDE, colorModulation), + TextureFactory.of(BlockIcons.OVERLAY_PIPE) + }; } return rTextures; } @@ -66,6 +70,7 @@ public class GT_MetaTileEntity_Boiler_Solar_Steel extends GT_MetaTileEntity_Boil @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Boiler_Solar_Steel(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mConfig); + return new GT_MetaTileEntity_Boiler_Solar_Steel( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mConfig); } } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java index 98546ff09e..b417ece4d5 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java @@ -1,14 +1,5 @@ package gregtech.common.tileentities.boilers; -import gregtech.GT_Mod; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.render.TextureFactory; -import gregtech.common.gui.GT_Container_Boiler; -import gregtech.common.gui.GT_GUIContainer_Boiler; -import net.minecraft.entity.player.InventoryPlayer; - import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT; import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_ACTIVE; import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_ACTIVE_GLOW; @@ -18,14 +9,24 @@ import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE; import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_TOP; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE; -public class GT_MetaTileEntity_Boiler_Steel extends GT_MetaTileEntity_Boiler_Bronze { +import gregtech.GT_Mod; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.render.TextureFactory; +import gregtech.common.gui.GT_Container_Boiler; +import gregtech.common.gui.GT_GUIContainer_Boiler; +import net.minecraft.entity.player.InventoryPlayer; +public class GT_MetaTileEntity_Boiler_Steel extends GT_MetaTileEntity_Boiler_Bronze { public GT_MetaTileEntity_Boiler_Steel(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, new String[]{ - "Faster than the Bronze Boiler", - "Produces 300L of Steam per second", - "Causes "+Integer.toString(GT_Mod.gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond)+" Pollution per second"}); + super(aID, aName, aNameRegional, new String[] { + "Faster than the Bronze Boiler", + "Produces 300L of Steam per second", + "Causes " + Integer.toString(GT_Mod.gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond) + + " Pollution per second" + }); } public GT_MetaTileEntity_Boiler_Steel(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -39,17 +40,27 @@ public class GT_MetaTileEntity_Boiler_Steel extends GT_MetaTileEntity_Boiler_Bro @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[5][17][]; - final ITexture[] - texBottom = {TextureFactory.of(MACHINE_STEELBRICKS_BOTTOM)}, + final ITexture[] texBottom = {TextureFactory.of(MACHINE_STEELBRICKS_BOTTOM)}, texTop = {TextureFactory.of(MACHINE_STEELBRICKS_TOP), TextureFactory.of(OVERLAY_PIPE)}, texSide = {TextureFactory.of(MACHINE_STEELBRICKS_SIDE), TextureFactory.of(OVERLAY_PIPE)}, - texFront = {TextureFactory.of(MACHINE_STEELBRICKS_SIDE), - TextureFactory.of(BOILER_FRONT), - TextureFactory.builder().addIcon(BOILER_FRONT_GLOW).glow().build()}, - texFrontActive = { - TextureFactory.of(MACHINE_STEELBRICKS_SIDE), - TextureFactory.of(BOILER_FRONT_ACTIVE), - TextureFactory.builder().addIcon(BOILER_FRONT_ACTIVE_GLOW).glow().build()}; + texFront = + { + TextureFactory.of(MACHINE_STEELBRICKS_SIDE), + TextureFactory.of(BOILER_FRONT), + TextureFactory.builder() + .addIcon(BOILER_FRONT_GLOW) + .glow() + .build() + }, + texFrontActive = + { + TextureFactory.of(MACHINE_STEELBRICKS_SIDE), + TextureFactory.of(BOILER_FRONT_ACTIVE), + TextureFactory.builder() + .addIcon(BOILER_FRONT_ACTIVE_GLOW) + .glow() + .build() + }; for (int i = 0; i < 17; i++) { rTextures[0][i] = texBottom; rTextures[1][i] = texTop; diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java index 6a712b41f5..ca6e77225e 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java @@ -1,13 +1,16 @@ package gregtech.common.tileentities.generators; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.ParticleFX; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.ItemList; +import gregtech.api.enums.ParticleFX; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -22,19 +25,18 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGenerator { - - public int mEfficiency; public GT_MetaTileEntity_DieselGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, new String[]{ - "Requires liquid Fuel", - "Causes " + (int) (GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond * GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier[aTier]) + " Pollution per second"}); + super(aID, aName, aNameRegional, aTier, new String[] { + "Requires liquid Fuel", + "Causes " + + (int) (GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond + * GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier[aTier]) + + " Pollution per second" + }); onConfigLoad(); } @@ -69,7 +71,10 @@ public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGe } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "DieselGenerator.efficiency.tier." + this.mTier, (100 - this.mTier * 5)); + this.mEfficiency = GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, + "DieselGenerator.efficiency.tier." + this.mTier, + (100 - this.mTier * 5)); } @Override @@ -93,7 +98,9 @@ public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGe @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aTick % 100 == 0 && mFluid != null && mFluid.amount > this.getCapacity()) { - GT_Log.err.println("Dupe Abuse: " + aBaseMetaTileEntity.getOwnerName() + " Coords: " + aBaseMetaTileEntity.getXCoord() + " " + aBaseMetaTileEntity.getYCoord() + " " + aBaseMetaTileEntity.getZCoord()); + GT_Log.err.println( + "Dupe Abuse: " + aBaseMetaTileEntity.getOwnerName() + " Coords: " + aBaseMetaTileEntity.getXCoord() + + " " + aBaseMetaTileEntity.getYCoord() + " " + aBaseMetaTileEntity.getZCoord()); aBaseMetaTileEntity.setToFire(); } super.onPostTick(aBaseMetaTileEntity, aTick); @@ -112,97 +119,159 @@ public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGe final byte topFacing = (byte) ForgeDirection.UP.ordinal(); if (aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { + && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { - final double x = aBaseMetaTileEntity.getOffsetX(topFacing, 1) + 2D / 16D - + XSTR_INSTANCE.nextFloat() * 14D / 16D; + final double x = + aBaseMetaTileEntity.getOffsetX(topFacing, 1) + 2D / 16D + XSTR_INSTANCE.nextFloat() * 14D / 16D; final double y = aBaseMetaTileEntity.getOffsetY(topFacing, 1) + 1D / 32D; - final double z = aBaseMetaTileEntity.getOffsetZ(topFacing, 1) + 2D / 16D - + XSTR_INSTANCE.nextFloat() * 14D / 16D; + final double z = + aBaseMetaTileEntity.getOffsetZ(topFacing, 1) + 2D / 16D + XSTR_INSTANCE.nextFloat() * 14D / 16D; new ParticleEventBuilder() - .setMotion(0D, 0D, 0D) - .setPosition(x, y, z) - .setWorld(getBaseMetaTileEntity().getWorld()) - .setIdentifier(ParticleFX.SMOKE).run(); + .setMotion(0D, 0D, 0D) + .setPosition(x, y, z) + .setWorld(getBaseMetaTileEntity().getWorld()) + .setIdentifier(ParticleFX.SMOKE) + .run(); } } } @Override public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_FRONT), - TextureFactory.builder().addIcon(DIESEL_GENERATOR_FRONT_GLOW).glow().build()), - OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[] { + super.getFront(aColor)[0], + TextureFactory.of( + TextureFactory.of(DIESEL_GENERATOR_FRONT), + TextureFactory.builder() + .addIcon(DIESEL_GENERATOR_FRONT_GLOW) + .glow() + .build()), + OVERLAYS_ENERGY_OUT[this.mTier] + }; } @Override public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_BACK), - TextureFactory.builder().addIcon(DIESEL_GENERATOR_BACK_GLOW).glow().build())}; + return new ITexture[] { + super.getBack(aColor)[0], + TextureFactory.of( + TextureFactory.of(DIESEL_GENERATOR_BACK), + TextureFactory.builder() + .addIcon(DIESEL_GENERATOR_BACK_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_BOTTOM), - TextureFactory.builder().addIcon(DIESEL_GENERATOR_BOTTOM_GLOW).glow().build())}; + return new ITexture[] { + super.getBottom(aColor)[0], + TextureFactory.of( + TextureFactory.of(DIESEL_GENERATOR_BOTTOM), + TextureFactory.builder() + .addIcon(DIESEL_GENERATOR_BOTTOM_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_TOP), - TextureFactory.builder().addIcon(DIESEL_GENERATOR_TOP_GLOW).glow().build())}; + return new ITexture[] { + super.getTop(aColor)[0], + TextureFactory.of( + TextureFactory.of(DIESEL_GENERATOR_TOP), + TextureFactory.builder() + .addIcon(DIESEL_GENERATOR_TOP_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_SIDE), - TextureFactory.builder().addIcon(DIESEL_GENERATOR_SIDE_GLOW).glow().build())}; + return new ITexture[] { + super.getSides(aColor)[0], + TextureFactory.of( + TextureFactory.of(DIESEL_GENERATOR_SIDE), + TextureFactory.builder() + .addIcon(DIESEL_GENERATOR_SIDE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_FRONT_ACTIVE), - TextureFactory.builder().addIcon(DIESEL_GENERATOR_FRONT_ACTIVE_GLOW).glow().build()), - OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[] { + super.getFrontActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(DIESEL_GENERATOR_FRONT_ACTIVE), + TextureFactory.builder() + .addIcon(DIESEL_GENERATOR_FRONT_ACTIVE_GLOW) + .glow() + .build()), + OVERLAYS_ENERGY_OUT[this.mTier] + }; } @Override public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_BACK_ACTIVE), - TextureFactory.builder().addIcon(DIESEL_GENERATOR_BACK_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getBackActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(DIESEL_GENERATOR_BACK_ACTIVE), + TextureFactory.builder() + .addIcon(DIESEL_GENERATOR_BACK_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_BOTTOM_ACTIVE), - TextureFactory.builder().addIcon(DIESEL_GENERATOR_BOTTOM_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getBottomActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(DIESEL_GENERATOR_BOTTOM_ACTIVE), + TextureFactory.builder() + .addIcon(DIESEL_GENERATOR_BOTTOM_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_TOP_ACTIVE), - TextureFactory.builder().addIcon(DIESEL_GENERATOR_TOP_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getTopActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(DIESEL_GENERATOR_TOP_ACTIVE), + TextureFactory.builder() + .addIcon(DIESEL_GENERATOR_TOP_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_SIDE_ACTIVE), - TextureFactory.builder().addIcon(DIESEL_GENERATOR_SIDE_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getSidesActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(DIESEL_GENERATOR_SIDE_ACTIVE), + TextureFactory.builder() + .addIcon(DIESEL_GENERATOR_SIDE_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public int getPollution() { - return (int) (GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond * GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier[mTier]); + return (int) (GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond + * GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier[mTier]); } } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java index a0f6aeee64..6a5ee85d99 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.generators; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; @@ -10,17 +12,18 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenera import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerator { - public int mEfficiency; public GT_MetaTileEntity_GasTurbine(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, new String[]{ - "Requires flammable Gasses", - "Causes " + (int) (GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond * GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier[aTier]) + " Pollution per second"}); + super(aID, aName, aNameRegional, aTier, new String[] { + "Requires flammable Gasses", + "Causes " + + (int) (GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond + * GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier[aTier]) + + " Pollution per second" + }); onConfigLoad(); } @@ -55,10 +58,10 @@ public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerat } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "GasTurbine.efficiency.tier." + this.mTier, (100 - this.mTier * 5)); + this.mEfficiency = GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, "GasTurbine.efficiency.tier." + this.mTier, (100 - this.mTier * 5)); } - @Override public int getEfficiency() { return this.mEfficiency; @@ -66,78 +69,139 @@ public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerat @Override public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], TextureFactory.of( - TextureFactory.of(GAS_TURBINE_FRONT), - TextureFactory.builder().addIcon(GAS_TURBINE_FRONT_GLOW).glow().build()), - OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[] { + super.getFront(aColor)[0], + TextureFactory.of( + TextureFactory.of(GAS_TURBINE_FRONT), + TextureFactory.builder() + .addIcon(GAS_TURBINE_FRONT_GLOW) + .glow() + .build()), + OVERLAYS_ENERGY_OUT[this.mTier] + }; } @Override public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], TextureFactory.of( - TextureFactory.of(GAS_TURBINE_BACK), - TextureFactory.builder().addIcon(GAS_TURBINE_BACK_GLOW).glow().build())}; + return new ITexture[] { + super.getBack(aColor)[0], + TextureFactory.of( + TextureFactory.of(GAS_TURBINE_BACK), + TextureFactory.builder() + .addIcon(GAS_TURBINE_BACK_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], TextureFactory.of( - TextureFactory.of(GAS_TURBINE_BOTTOM), - TextureFactory.builder().addIcon(GAS_TURBINE_BOTTOM_GLOW).glow().build())}; + return new ITexture[] { + super.getBottom(aColor)[0], + TextureFactory.of( + TextureFactory.of(GAS_TURBINE_BOTTOM), + TextureFactory.builder() + .addIcon(GAS_TURBINE_BOTTOM_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], TextureFactory.of( - TextureFactory.of(GAS_TURBINE_TOP), - TextureFactory.builder().addIcon(GAS_TURBINE_TOP_GLOW).glow().build())}; + return new ITexture[] { + super.getTop(aColor)[0], + TextureFactory.of( + TextureFactory.of(GAS_TURBINE_TOP), + TextureFactory.builder() + .addIcon(GAS_TURBINE_TOP_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], TextureFactory.of( - TextureFactory.of(GAS_TURBINE_SIDE), - TextureFactory.builder().addIcon(GAS_TURBINE_SIDE_GLOW).glow().build())}; + return new ITexture[] { + super.getSides(aColor)[0], + TextureFactory.of( + TextureFactory.of(GAS_TURBINE_SIDE), + TextureFactory.builder() + .addIcon(GAS_TURBINE_SIDE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], TextureFactory.of( - TextureFactory.of(GAS_TURBINE_FRONT_ACTIVE), - TextureFactory.builder().addIcon(GAS_TURBINE_FRONT_ACTIVE_GLOW).glow().build()), - OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[] { + super.getFrontActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(GAS_TURBINE_FRONT_ACTIVE), + TextureFactory.builder() + .addIcon(GAS_TURBINE_FRONT_ACTIVE_GLOW) + .glow() + .build()), + OVERLAYS_ENERGY_OUT[this.mTier] + }; } @Override public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], TextureFactory.of( - TextureFactory.of(GAS_TURBINE_BACK_ACTIVE), - TextureFactory.builder().addIcon(GAS_TURBINE_BACK_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getBackActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(GAS_TURBINE_BACK_ACTIVE), + TextureFactory.builder() + .addIcon(GAS_TURBINE_BACK_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], TextureFactory.of( - TextureFactory.of(GAS_TURBINE_BOTTOM_ACTIVE), - TextureFactory.builder().addIcon(GAS_TURBINE_BOTTOM_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getBottomActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(GAS_TURBINE_BOTTOM_ACTIVE), + TextureFactory.builder() + .addIcon(GAS_TURBINE_BOTTOM_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], TextureFactory.of( - TextureFactory.of(GAS_TURBINE_TOP_ACTIVE), - TextureFactory.builder().addIcon(GAS_TURBINE_TOP_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getTopActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(GAS_TURBINE_TOP_ACTIVE), + TextureFactory.builder() + .addIcon(GAS_TURBINE_TOP_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], TextureFactory.of( - TextureFactory.of(GAS_TURBINE_SIDE_ACTIVE), - TextureFactory.builder().addIcon(GAS_TURBINE_SIDE_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getSidesActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(GAS_TURBINE_SIDE_ACTIVE), + TextureFactory.builder() + .addIcon(GAS_TURBINE_SIDE_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public int getPollution() { - return (int) (GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond * GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier[mTier]); + return (int) (GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond + * GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier[mTier]); } } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java index 88d49075e5..dbb8931848 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.generators; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; @@ -14,36 +16,46 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMachineBlock { public GT_MetaTileEntity_LightningRod(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 0, "Generates EU From Lightning Bolts"); } - public GT_MetaTileEntity_LightningRod(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_LightningRod( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - - public GT_MetaTileEntity_LightningRod(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + + public GT_MetaTileEntity_LightningRod( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide != ForgeDirection.UP.ordinal()) { - return new ITexture[]{ - BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], - BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]}; + return new ITexture[] { + BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier] + }; } - if (!aActive) return new ITexture[]{ + if (!aActive) + return new ITexture[] { BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS) - }; - return new ITexture[]{ - BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW), - TextureFactory.builder().addIcon(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build() + }; + return new ITexture[] { + BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder() + .addIcon(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW) + .glow() + .build() }; } @@ -54,7 +66,8 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_LightningRod(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_LightningRod( + this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } @Override @@ -76,7 +89,11 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach int aZ = aBaseMetaTileEntity.getZCoord(); for (int i = aBaseMetaTileEntity.getYCoord() + 1; i < aWorld.getHeight() - 1; i++) { - if (isRodValid && aBaseMetaTileEntity.getBlock(aX, i, aZ).getUnlocalizedName().equals("blockFenceIron")) { + if (isRodValid + && aBaseMetaTileEntity + .getBlock(aX, i, aZ) + .getUnlocalizedName() + .equals("blockFenceIron")) { aRodValue++; } else { isRodValid = false; @@ -88,7 +105,8 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach } if (!aWorld.isThundering() && ((aY + aRodValue) < 128)) aRodValue = 0; if (XSTR_INSTANCE.nextInt(4 * aWorld.getHeight()) < (aRodValue * (aY + aRodValue))) { - aBaseMetaTileEntity.increaseStoredEnergyUnits(maxEUStore() - aBaseMetaTileEntity.getStoredEU(), false); + aBaseMetaTileEntity.increaseStoredEnergyUnits( + maxEUStore() - aBaseMetaTileEntity.getStoredEU(), false); aWorld.addWeatherEffect(new EntityLightningBolt(aWorld, aX, aY + aRodValue, aZ)); } } @@ -112,7 +130,7 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach @Override public boolean isFacingValid(byte aFacing) { - return aFacing==1; + return aFacing == 1; } @Override @@ -146,10 +164,8 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach } @Override - public void saveNBTData(NBTTagCompound aNBT) { - } + public void saveNBTData(NBTTagCompound aNBT) {} @Override - public void loadNBTData(NBTTagCompound aNBT) { - } + public void loadNBTData(NBTTagCompound aNBT) {} } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java index aceab00a02..2e1bfd655f 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java @@ -1,14 +1,5 @@ package gregtech.common.tileentities.generators; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Recipe; - import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC; import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE; import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE_GLOW; @@ -19,6 +10,15 @@ import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_GLOW; import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; +import gregtech.api.GregTech_API; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Recipe; + public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_BasicGenerator { public int mEfficiency; @@ -27,12 +27,14 @@ public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_Ba onConfigLoad(); } - public GT_MetaTileEntity_MagicEnergyConverter(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_MagicEnergyConverter( + String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); onConfigLoad(); } - public GT_MetaTileEntity_MagicEnergyConverter(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_MagicEnergyConverter( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); onConfigLoad(); } @@ -44,7 +46,8 @@ public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_Ba @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_MagicEnergyConverter(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_MagicEnergyConverter( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } @Override @@ -58,10 +61,12 @@ public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_Ba } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MagicEnergyConverter.efficiency.tier." + this.mTier, 100 - this.mTier * 5); + this.mEfficiency = GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, + "MagicEnergyConverter.efficiency.tier." + this.mTier, + 100 - this.mTier * 5); } - @Override public int getEfficiency() { return this.mEfficiency; @@ -69,88 +74,116 @@ public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_Ba @Override public ITexture[] getFront(byte aColor) { - return new ITexture[]{ - super.getFront(aColor)[0], - TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build(), - OVERLAYS_ENERGY_OUT[mTier]}; + return new ITexture[] { + super.getFront(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build(), + OVERLAYS_ENERGY_OUT[mTier] + }; } @Override public ITexture[] getBack(byte aColor) { - return new ITexture[]{ - super.getBack(aColor)[0], - TextureFactory.of(MACHINE_CASING_MAGIC_FRONT), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_FRONT_GLOW).glow().build()}; + return new ITexture[] { + super.getBack(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_FRONT), + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_FRONT_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottom(byte aColor) { - return new ITexture[]{ - super.getBottom(aColor)[0], - TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build()}; + return new ITexture[] { + super.getBottom(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build() + }; } @Override public ITexture[] getTop(byte aColor) { - return new ITexture[]{ - super.getTop(aColor)[0], - TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build()}; + return new ITexture[] { + super.getTop(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build() + }; } @Override public ITexture[] getSides(byte aColor) { - return new ITexture[]{ - super.getSides(aColor)[0], - TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build()}; + return new ITexture[] { + super.getSides(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build() + }; } @Override public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{ - super.getFrontActive(aColor)[0], - TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build(), - OVERLAYS_ENERGY_OUT[mTier]}; + return new ITexture[] { + super.getFrontActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) + .glow() + .build(), + OVERLAYS_ENERGY_OUT[mTier] + }; } @Override public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{ - super.getBackActive(aColor)[0], - TextureFactory.of(MACHINE_CASING_MAGIC_FRONT_ACTIVE), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW).glow().build()}; + return new ITexture[] { + super.getBackActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_FRONT_ACTIVE), + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{ - super.getBottomActive(aColor)[0], - TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build()}; + return new ITexture[] { + super.getBottomActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{ - super.getTopActive(aColor)[0], - TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build()}; + return new ITexture[] { + super.getTopActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{ - super.getSidesActive(aColor)[0], - TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build()}; + return new ITexture[] { + super.getSidesActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) + .glow() + .build() + }; } - @Override - public int getPollution() { - return 0; - } + @Override + public int getPollution() { + return 0; + } } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java index 4158a22b47..210483cbe8 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java @@ -1,5 +1,17 @@ package gregtech.common.tileentities.generators; +import static gregtech.api.enums.ConfigCategories.machineconfig; +import static gregtech.api.enums.GT_Values.MOD_ID_TC; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; +import static net.minecraft.util.EnumChatFormatting.GRAY; +import static net.minecraft.util.EnumChatFormatting.GREEN; +import static net.minecraft.util.EnumChatFormatting.LIGHT_PURPLE; +import static net.minecraft.util.EnumChatFormatting.RESET; +import static net.minecraft.util.EnumChatFormatting.UNDERLINE; +import static net.minecraft.util.EnumChatFormatting.YELLOW; + import com.google.common.base.Enums; import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.Side; @@ -18,6 +30,14 @@ import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; import net.minecraft.block.Block; import net.minecraft.block.BlockDragonEgg; import net.minecraft.enchantment.Enchantment; @@ -40,36 +60,18 @@ import thaumcraft.api.aspects.AspectSourceHelper; import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.api.visnet.VisNetHandler; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -import static gregtech.api.enums.ConfigCategories.machineconfig; -import static gregtech.api.enums.GT_Values.MOD_ID_TC; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; -import static net.minecraft.util.EnumChatFormatting.GRAY; -import static net.minecraft.util.EnumChatFormatting.GREEN; -import static net.minecraft.util.EnumChatFormatting.LIGHT_PURPLE; -import static net.minecraft.util.EnumChatFormatting.RESET; -import static net.minecraft.util.EnumChatFormatting.UNDERLINE; -import static net.minecraft.util.EnumChatFormatting.YELLOW; - interface MagicalEnergyBBListener { void onMagicalEnergyBBUpdate(); } -public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_BasicGenerator implements MagicalEnergyBBListener { +public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_BasicGenerator + implements MagicalEnergyBBListener { private static final boolean THAUMCRAFT_LOADED = Loader.isModLoaded(MOD_ID_TC); - private static final ConcurrentHashMap<UUID, GT_MetaTileEntity_MagicalEnergyAbsorber> sSubscribedCrystals = new ConcurrentHashMap<>(4); - private static final List<Aspect> sPrimalAspects = (THAUMCRAFT_LOADED) ? Aspect.getPrimalAspects() : new ArrayList<>(); + private static final ConcurrentHashMap<UUID, GT_MetaTileEntity_MagicalEnergyAbsorber> sSubscribedCrystals = + new ConcurrentHashMap<>(4); + private static final List<Aspect> sPrimalAspects = + (THAUMCRAFT_LOADED) ? Aspect.getPrimalAspects() : new ArrayList<>(); private static final Map<Aspect, Integer> sAspectsEnergy = new HashMap<>(); private static boolean sAllowMultipleEggs = false; private static GT_MetaTileEntity_MagicalEnergyAbsorber sActiveSiphon = null; @@ -90,7 +92,8 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B onConfigLoad(GregTech_API.sMachineFile); } - private GT_MetaTileEntity_MagicalEnergyAbsorber(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + private GT_MetaTileEntity_MagicalEnergyAbsorber( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); onConfigLoad(GregTech_API.sMachineFile); } @@ -110,10 +113,12 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B sEnergyPerEssentia = aConfig.get(machineconfig, "MagicEnergyAbsorber.EnergyPerEssentia", 320); for (Aspect tAspect : Aspect.aspects.values()) { //noinspection UnstableApiUsage - sAspectsEnergy.put(tAspect, - Enums.getIfPresent(TC_Aspects.class, - tAspect.getTag().toUpperCase(Locale.ENGLISH)).or(TC_Aspects.AER).mValue - * sEnergyPerEssentia); + sAspectsEnergy.put( + tAspect, + Enums.getIfPresent(TC_Aspects.class, tAspect.getTag().toUpperCase(Locale.ENGLISH)) + .or(TC_Aspects.AER) + .mValue + * sEnergyPerEssentia); } } } @@ -126,7 +131,8 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B public void onConfigLoad(GT_Config aConfig) { sharedConfigLoad(aConfig); mEfficiency = aConfig.get(machineconfig, "MagicEnergyAbsorber.efficiency.tier." + mTier, 100 - mTier * 10); - mMaxVisPerDrain = (int) Math.round(Math.sqrt((double) (V[mTier] * 10000) / (sEnergyFromVis * (getEfficiency() != 0 ? getEfficiency() : 100)))); + mMaxVisPerDrain = (int) Math.round(Math.sqrt( + (double) (V[mTier] * 10000) / (sEnergyFromVis * (getEfficiency() != 0 ? getEfficiency() : 100)))); if (Math.pow(mMaxVisPerDrain, 2) * sEnergyFromVis * (getEfficiency() != 0 ? getEfficiency() : 100) < V[mTier]) { mMaxVisPerDrain += 1; } @@ -136,7 +142,14 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) mMagicalEnergyBB.decreaseTier(); else mMagicalEnergyBB.increaseTier(); - GT_Utility.sendChatToPlayer(aPlayer, String.format(GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_MagicalEnergyAbsorber_Screwdriver", "Absorption range: %s blocks"), mMagicalEnergyBB.getRange(), true)); + GT_Utility.sendChatToPlayer( + aPlayer, + String.format( + GT_LanguageManager.addStringLocalization( + "Interaction_DESCRIPTION_MagicalEnergyAbsorber_Screwdriver", + "Absorption range: %s blocks"), + mMagicalEnergyBB.getRange(), + true)); mMagicalEnergyBB.update(); } @@ -188,22 +201,27 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B final String LI = "-%%%"; final String EU_PER = "%%%EU per "; List<String> description = new ArrayList<>(); - description.add(UNDERLINE + "Feasts on " + LIGHT_PURPLE + UNDERLINE + "magic" + GRAY + UNDERLINE + " close to it:"); - description.add(LI + (sAllowMultipleEggs ? "A " : "An " + YELLOW + UNDERLINE + "EXCLUSIVE" + RESET) + GRAY + " " + LIGHT_PURPLE + "Dragon Egg" + GRAY + " atop"); + description.add( + UNDERLINE + "Feasts on " + LIGHT_PURPLE + UNDERLINE + "magic" + GRAY + UNDERLINE + " close to it:"); + description.add(LI + (sAllowMultipleEggs ? "A " : "An " + YELLOW + UNDERLINE + "EXCLUSIVE" + RESET) + GRAY + " " + + LIGHT_PURPLE + "Dragon Egg" + GRAY + " atop"); if (sEnergyPerEndercrystal > 0) { description.add(LI + sEnergyPerEndercrystal + EU_PER + LIGHT_PURPLE + "Ender Crystal" + GRAY + " in range"); } if (THAUMCRAFT_LOADED) { description.add(LI + mMaxVisPerDrain + "%%%CV/t from an " + LIGHT_PURPLE + "Energised Node" + GRAY); - description.add(LI + (sEnergyPerEssentia * getEfficiency()) / 100 + EU_PER + LIGHT_PURPLE + "Essentia" + GRAY + " Aspect-Value from containers in range"); + description.add(LI + (sEnergyPerEssentia * getEfficiency()) / 100 + EU_PER + LIGHT_PURPLE + "Essentia" + + GRAY + " Aspect-Value from containers in range"); } description.add(" "); description.add(UNDERLINE + "Lookup range (Use Screwdriver to change):"); description.add("Default:%%%" + GREEN + mMagicalEnergyBB.getDefaultRange()); description.add("Max:%%%" + GREEN + mMagicalEnergyBB.getMaxRange()); description.add(" "); - description.add(UNDERLINE + "Fuels on " + LIGHT_PURPLE + UNDERLINE + "enchantments" + GRAY + UNDERLINE + " input:"); - description.add("- Item:%%%" + (10000 * getEfficiency()) / 100 + EU_PER + LIGHT_PURPLE + "enchant" + GRAY + " weight × level / max"); + description.add( + UNDERLINE + "Fuels on " + LIGHT_PURPLE + UNDERLINE + "enchantments" + GRAY + UNDERLINE + " input:"); + description.add("- Item:%%%" + (10000 * getEfficiency()) / 100 + EU_PER + LIGHT_PURPLE + "enchant" + GRAY + + " weight × level / max"); description.add("- Book:%%%" + 10000 + EU_PER + LIGHT_PURPLE + "enchant" + GRAY + " weight × level / max"); description.add(" "); description.add("Efficiency:%%%" + GREEN + getEfficiency() + "%"); @@ -212,84 +230,108 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B @Override public ITexture[] getFront(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFront(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC), TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build(), - OVERLAYS_ENERGY_OUT[mTier]}; + OVERLAYS_ENERGY_OUT[mTier] + }; } @Override public ITexture[] getBack(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBack(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_FRONT), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_FRONT_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_FRONT_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottom(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottom(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build()}; + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build() + }; } @Override public ITexture[] getTop(byte aColor) { - return new ITexture[]{ - super.getTop(aColor)[0], - TextureFactory.of(MACHINE_CASING_DRAGONEGG)}; + return new ITexture[] {super.getTop(aColor)[0], TextureFactory.of(MACHINE_CASING_DRAGONEGG)}; } @Override public ITexture[] getSides(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSides(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build()}; + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build() + }; } @Override public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build(), - OVERLAYS_ENERGY_OUT[mTier]}; + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) + .glow() + .build(), + OVERLAYS_ENERGY_OUT[mTier] + }; } @Override public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBackActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_FRONT_ACTIVE), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopActive(aColor)[0], TextureFactory.of(MACHINE_CASING_DRAGONEGG), - TextureFactory.builder().addIcon(MACHINE_CASING_DRAGONEGG_GLOW).glow().build() + TextureFactory.builder() + .addIcon(MACHINE_CASING_DRAGONEGG_GLOW) + .glow() + .build() }; } @Override public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSidesActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) + .glow() + .build() + }; } @Override @@ -331,7 +373,8 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B mNextGenerateTickRate = 20; } aBaseMetaTileEntity.increaseStoredEnergyUnits(tGeneratedEU, true); - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() + && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); } } @@ -355,8 +398,8 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B final double oZ = aBaseMetaTileEntity.getZCoord() + 8D / 16D; final ParticleEventBuilder particleEventBuilder = new ParticleEventBuilder() - .setWorld(getBaseMetaTileEntity().getWorld()) - .setIdentifier(ParticleFX.PORTAL); + .setWorld(getBaseMetaTileEntity().getWorld()) + .setIdentifier(ParticleFX.PORTAL); for (int i = 0; i < 9; i++) { final double dX = (XSTR_INSTANCE.nextFloat() - 0.5D) / 2D; @@ -372,7 +415,10 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B final double mY = -(dXZ * dY) / 4D; final double mZ = dZ * 4D; - particleEventBuilder.setMotion(mX, mY, mZ).setPosition(x, y, z).run(); + particleEventBuilder + .setMotion(mX, mY, mZ) + .setPosition(x, y, z) + .run(); } } } @@ -452,8 +498,9 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B } // Only consume input when it can store EU and push output - if ((getBaseMetaTileEntity().getStoredEU() + tEU) < getBaseMetaTileEntity().getEUCapacity() - && getBaseMetaTileEntity().addStackToSlot(getOutputSlot(), tOutputStack)) { + if ((getBaseMetaTileEntity().getStoredEU() + tEU) + < getBaseMetaTileEntity().getEUCapacity() + && getBaseMetaTileEntity().addStackToSlot(getOutputSlot(), tOutputStack)) { decrStackSize(getInputSlot(), 1); } else { tEU = 0; @@ -470,11 +517,11 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B if (!hasEgg()) return 0; if (!sAllowMultipleEggs) { if (sActiveSiphon != null - && sActiveSiphon != this - && sActiveSiphon.getBaseMetaTileEntity() != null - && !sActiveSiphon.getBaseMetaTileEntity().isInvalidTileEntity() - && sActiveSiphon.isChunkLoaded() - && sActiveSiphon.hasEgg()) { + && sActiveSiphon != this + && sActiveSiphon.getBaseMetaTileEntity() != null + && !sActiveSiphon.getBaseMetaTileEntity().isInvalidTileEntity() + && sActiveSiphon.isChunkLoaded() + && sActiveSiphon.hasEgg()) { getBaseMetaTileEntity().doExplosion(Integer.MAX_VALUE); } else { setActiveSiphon(this); @@ -528,7 +575,8 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B long tEU = 0; - long tEUtoGen = getBaseMetaTileEntity().getEUCapacity() - getBaseMetaTileEntity().getUniversalEnergyStored(); + long tEUtoGen = getBaseMetaTileEntity().getEUCapacity() + - getBaseMetaTileEntity().getUniversalEnergyStored(); List<Aspect> mAvailableEssentiaAspects = mMagicalEnergyBB.getAvailableAspects(); // try to drain 1 of whatever aspect available in containers within RANGE @@ -536,7 +584,11 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B Aspect aspect = mAvailableEssentiaAspects.get(i); long tAspectEU = ((long) sAspectsEnergy.get(aspect) * getEfficiency()) / 100; if (tAspectEU <= tEUtoGen - && AspectSourceHelper.drainEssentia((TileEntity) getBaseMetaTileEntity(), aspect, ForgeDirection.UNKNOWN, mMagicalEnergyBB.getRange())) { + && AspectSourceHelper.drainEssentia( + (TileEntity) getBaseMetaTileEntity(), + aspect, + ForgeDirection.UNKNOWN, + mMagicalEnergyBB.getRange())) { tEUtoGen -= tAspectEU; tEU += tAspectEU; } @@ -657,15 +709,14 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B double tX = tBaseMetaTileEntity.getXCoord(); double tY = tBaseMetaTileEntity.getYCoord(); double tZ = tBaseMetaTileEntity.getZCoord(); - return AxisAlignedBB.getBoundingBox(tX - tRange, tY - tRange, tZ - tRange, - tX + tRange, tY + tRange, tZ + tRange); + return AxisAlignedBB.getBoundingBox( + tX - tRange, tY - tRange, tZ - tRange, tX + tRange, tY + tRange, tZ + tRange); } private void scanLivingCrystals() { World tWorld = mAbsorber.getBaseMetaTileEntity().getWorld(); mLivingCrystalIDs.clear(); - for (Object o : tWorld.getEntitiesWithinAABB(EntityEnderCrystal.class, - getAxisAlignedBB())) { + for (Object o : tWorld.getEntitiesWithinAABB(EntityEnderCrystal.class, getAxisAlignedBB())) { if (((EntityEnderCrystal) o).isEntityAlive()) { mLivingCrystalIDs.add(((EntityEnderCrystal) o).getPersistentID()); } @@ -678,10 +729,10 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B if (tBaseMetaTileEntity.isInvalidTileEntity()) return; int tRange = getRange(); int tY = tBaseMetaTileEntity.getYCoord(); - int tMaxY = tBaseMetaTileEntity.getWorld().getHeight()-1; + int tMaxY = tBaseMetaTileEntity.getWorld().getHeight() - 1; // Make sure relative Y range stays between 0 and world max Y int rYMin = (tY - tRange >= 0) ? -tRange : -(tY); - int rYMax = (((tY + tRange) <= tMaxY)? tRange : tMaxY - tY); + int rYMax = (((tY + tRange) <= tMaxY) ? tRange : tMaxY - tY); mAvailableAspects.clear(); for (int rX = -tRange; rX <= tRange; rX++) { for (int rZ = -tRange; rZ <= tRange; rZ++) { diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java index 0a99a4af05..6ca6da874f 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.generators; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; @@ -9,13 +11,12 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenera import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGenerator { private int mEfficiency; - public GT_MetaTileEntity_NaquadahReactor(int aID, String aName, String[] aDescription, String aNameRegional, int aTier) { + public GT_MetaTileEntity_NaquadahReactor( + int aID, String aName, String[] aDescription, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, aDescription); if (aTier > 8 || aTier < 4) { new Exception("Tier without Recipe Map!").printStackTrace(); @@ -33,7 +34,9 @@ public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGe @Override public boolean isOutputFacing(byte aSide) { - return (aSide > 1) && (aSide != getBaseMetaTileEntity().getFrontFacing()) && (aSide != getBaseMetaTileEntity().getBackFacing()); + return (aSide > 1) + && (aSide != getBaseMetaTileEntity().getFrontFacing()) + && (aSide != getBaseMetaTileEntity().getBackFacing()); } @Override @@ -69,7 +72,6 @@ public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGe ret = null; break; } - } return ret; } @@ -89,82 +91,133 @@ public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGe } public int onConfigLoad() { - return mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "SolidNaquadah.efficiency.tier." + mTier, getBaseEff()); + return mEfficiency = GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, "SolidNaquadah.efficiency.tier." + mTier, getBaseEff()); } @Override public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], TextureFactory.of( - TextureFactory.of(NAQUADAH_REACTOR_SOLID_FRONT), - TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_FRONT_GLOW).glow().build())}; + return new ITexture[] { + super.getFront(aColor)[0], + TextureFactory.of( + TextureFactory.of(NAQUADAH_REACTOR_SOLID_FRONT), + TextureFactory.builder() + .addIcon(NAQUADAH_REACTOR_SOLID_FRONT_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], TextureFactory.of( - TextureFactory.of(NAQUADAH_REACTOR_SOLID_BACK), - TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_BACK_GLOW).glow().build())}; + return new ITexture[] { + super.getBack(aColor)[0], + TextureFactory.of( + TextureFactory.of(NAQUADAH_REACTOR_SOLID_BACK), + TextureFactory.builder() + .addIcon(NAQUADAH_REACTOR_SOLID_BACK_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], TextureFactory.of( - TextureFactory.of(NAQUADAH_REACTOR_SOLID_BOTTOM), - TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_BOTTOM_GLOW).glow().build())}; + return new ITexture[] { + super.getBottom(aColor)[0], + TextureFactory.of( + TextureFactory.of(NAQUADAH_REACTOR_SOLID_BOTTOM), + TextureFactory.builder() + .addIcon(NAQUADAH_REACTOR_SOLID_BOTTOM_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], TextureFactory.of( - TextureFactory.of(NAQUADAH_REACTOR_SOLID_TOP), - TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_TOP_GLOW).glow().build())}; + return new ITexture[] { + super.getTop(aColor)[0], + TextureFactory.of( + TextureFactory.of(NAQUADAH_REACTOR_SOLID_TOP), + TextureFactory.builder() + .addIcon(NAQUADAH_REACTOR_SOLID_TOP_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], TextureFactory.of( - TextureFactory.of(NAQUADAH_REACTOR_SOLID_SIDE), - TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_SIDE_GLOW).glow().build())}; + return new ITexture[] { + super.getSides(aColor)[0], + TextureFactory.of( + TextureFactory.of(NAQUADAH_REACTOR_SOLID_SIDE), + TextureFactory.builder() + .addIcon(NAQUADAH_REACTOR_SOLID_SIDE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{ - super.getFrontActive(aColor)[0], - TextureFactory.of(NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE), - TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE_GLOW).glow().build()}; + return new ITexture[] { + super.getFrontActive(aColor)[0], + TextureFactory.of(NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE), + TextureFactory.builder() + .addIcon(NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{ - super.getBackActive(aColor)[0], - TextureFactory.of(NAQUADAH_REACTOR_SOLID_BACK_ACTIVE), - TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_BACK_ACTIVE_GLOW).glow().build()}; + return new ITexture[] { + super.getBackActive(aColor)[0], + TextureFactory.of(NAQUADAH_REACTOR_SOLID_BACK_ACTIVE), + TextureFactory.builder() + .addIcon(NAQUADAH_REACTOR_SOLID_BACK_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{ - super.getBottomActive(aColor)[0], - TextureFactory.of(NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE), - TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE_GLOW).glow().build()}; + return new ITexture[] { + super.getBottomActive(aColor)[0], + TextureFactory.of(NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE), + TextureFactory.builder() + .addIcon(NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{ - super.getTopActive(aColor)[0], - TextureFactory.of(NAQUADAH_REACTOR_SOLID_TOP_ACTIVE), - TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_TOP_ACTIVE_GLOW).glow().build()}; + return new ITexture[] { + super.getTopActive(aColor)[0], + TextureFactory.of(NAQUADAH_REACTOR_SOLID_TOP_ACTIVE), + TextureFactory.builder() + .addIcon(NAQUADAH_REACTOR_SOLID_TOP_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{ - super.getSidesActive(aColor)[0], - TextureFactory.of(NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE), - TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE_GLOW).glow().build()}; + return new ITexture[] { + super.getSidesActive(aColor)[0], + TextureFactory.of(NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE), + TextureFactory.builder() + .addIcon(NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE_GLOW) + .glow() + .build() + }; } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java index 4ab048a0f7..4e0b428fa4 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java @@ -1,5 +1,10 @@ package gregtech.common.tileentities.generators; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; + import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; @@ -9,11 +14,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenera import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; - public class GT_MetaTileEntity_PlasmaGenerator extends GT_MetaTileEntity_BasicGenerator { public int mEfficiency; @@ -35,71 +35,90 @@ public class GT_MetaTileEntity_PlasmaGenerator extends GT_MetaTileEntity_BasicGe @Override public ITexture[] getFront(byte aColor) { - return new ITexture[]{ - super.getFront(aColor)[0], - TextureFactory.of(MACHINE_CASING_FUSION_GLASS), - OVERLAYS_ENERGY_OUT[mTier]}; + return new ITexture[] { + super.getFront(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS), OVERLAYS_ENERGY_OUT[mTier] + }; } @Override public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; + return new ITexture[] {super.getBack(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; } @Override public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; + return new ITexture[] {super.getBottom(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; } @Override public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; + return new ITexture[] {super.getTop(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; } @Override public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; + return new ITexture[] {super.getSides(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; } @Override public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{ - super.getFrontActive(aColor)[0], - TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), - TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build(), - OVERLAYS_ENERGY_OUT[mTier]}; + return new ITexture[] { + super.getFrontActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder() + .addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW) + .glow() + .build(), + OVERLAYS_ENERGY_OUT[mTier] + }; } @Override public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{ - super.getBackActive(aColor)[0], - TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), - TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build()}; + return new ITexture[] { + super.getBackActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder() + .addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{ - super.getBottomActive(aColor)[0], - TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), - TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build()}; + return new ITexture[] { + super.getBottomActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder() + .addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{ - super.getTopActive(aColor)[0], - TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), - TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build()}; + return new ITexture[] { + super.getTopActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder() + .addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{ - super.getSidesActive(aColor)[0], - TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), - TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build()}; + return new ITexture[] { + super.getSidesActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder() + .addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW) + .glow() + .build() + }; } @Override @@ -128,11 +147,14 @@ public class GT_MetaTileEntity_PlasmaGenerator extends GT_MetaTileEntity_BasicGe } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "PlasmaGenerator.efficiency.tier." + this.mTier, Math.max(10, 10 + Math.min(90, this.mTier * 10))); + this.mEfficiency = GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, + "PlasmaGenerator.efficiency.tier." + this.mTier, + Math.max(10, 10 + Math.min(90, this.mTier * 10))); } @Override - public int getPollution() { - return 0; - } + public int getPollution() { + return 0; + } } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java index d7b3f03fde..bec1b90ad1 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.generators; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; @@ -11,16 +13,13 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import net.minecraftforge.fluids.FluidStack; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGenerator { public int mEfficiency; public GT_MetaTileEntity_SteamTurbine(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, new String[]{ - "Converts Steam into EU", - "Base rate: 2L of Steam -> 1 EU"}); + super(aID, aName, aNameRegional, aTier, new String[] {"Converts Steam into EU", "Base rate: 2L of Steam -> 1 EU" + }); onConfigLoad(); } @@ -54,7 +53,8 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener String[] desc = new String[mDescriptionArray.length + 2]; System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); desc[mDescriptionArray.length] = "Fuel Efficiency: " + (600 / getEfficiency()) + "%"; - desc[mDescriptionArray.length + 1] = String.format("Consumes up to %sL of Steam per second", + desc[mDescriptionArray.length + 1] = String.format( + "Consumes up to %sL of Steam per second", (int) (4000 * (8 * Math.pow(4, mTier) + Math.pow(2, mTier)) / (600 / getEfficiency()))); return desc; } @@ -65,7 +65,8 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "SteamTurbine.efficiency.tier." + this.mTier, 6 + this.mTier); + this.mEfficiency = GregTech_API.sMachineFile.get( + ConfigCategories.machineconfig, "SteamTurbine.efficiency.tier." + this.mTier, 6 + this.mTier); } @Override @@ -86,74 +87,134 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener @Override public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], TextureFactory.of( - TextureFactory.of(STEAM_TURBINE_FRONT), - TextureFactory.builder().addIcon(STEAM_TURBINE_FRONT_GLOW).glow().build()), - OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[] { + super.getFront(aColor)[0], + TextureFactory.of( + TextureFactory.of(STEAM_TURBINE_FRONT), + TextureFactory.builder() + .addIcon(STEAM_TURBINE_FRONT_GLOW) + .glow() + .build()), + OVERLAYS_ENERGY_OUT[this.mTier] + }; } @Override public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], TextureFactory.of( - TextureFactory.of(STEAM_TURBINE_BACK), - TextureFactory.builder().addIcon(STEAM_TURBINE_BACK_GLOW).glow().build())}; + return new ITexture[] { + super.getBack(aColor)[0], + TextureFactory.of( + TextureFactory.of(STEAM_TURBINE_BACK), + TextureFactory.builder() + .addIcon(STEAM_TURBINE_BACK_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], TextureFactory.of( - TextureFactory.of(STEAM_TURBINE_BOTTOM), - TextureFactory.builder().addIcon(STEAM_TURBINE_BOTTOM_GLOW).glow().build())}; + return new ITexture[] { + super.getBottom(aColor)[0], + TextureFactory.of( + TextureFactory.of(STEAM_TURBINE_BOTTOM), + TextureFactory.builder() + .addIcon(STEAM_TURBINE_BOTTOM_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], TextureFactory.of( - TextureFactory.of(STEAM_TURBINE_TOP), - TextureFactory.builder().addIcon(STEAM_TURBINE_TOP_GLOW).glow().build())}; + return new ITexture[] { + super.getTop(aColor)[0], + TextureFactory.of( + TextureFactory.of(STEAM_TURBINE_TOP), + TextureFactory.builder() + .addIcon(STEAM_TURBINE_TOP_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], TextureFactory.of( - TextureFactory.of(STEAM_TURBINE_SIDE), - TextureFactory.builder().addIcon(STEAM_TURBINE_SIDE_GLOW).glow().build())}; + return new ITexture[] { + super.getSides(aColor)[0], + TextureFactory.of( + TextureFactory.of(STEAM_TURBINE_SIDE), + TextureFactory.builder() + .addIcon(STEAM_TURBINE_SIDE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], TextureFactory.of( - TextureFactory.of(STEAM_TURBINE_FRONT_ACTIVE), - TextureFactory.builder().addIcon(STEAM_TURBINE_FRONT_ACTIVE_GLOW).glow().build()), - OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[] { + super.getFrontActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(STEAM_TURBINE_FRONT_ACTIVE), + TextureFactory.builder() + .addIcon(STEAM_TURBINE_FRONT_ACTIVE_GLOW) + .glow() + .build()), + OVERLAYS_ENERGY_OUT[this.mTier] + }; } @Override public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], TextureFactory.of( - TextureFactory.of(STEAM_TURBINE_BACK_ACTIVE), - TextureFactory.builder().addIcon(STEAM_TURBINE_BACK_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getBackActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(STEAM_TURBINE_BACK_ACTIVE), + TextureFactory.builder() + .addIcon(STEAM_TURBINE_BACK_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], TextureFactory.of( - TextureFactory.of(STEAM_TURBINE_BOTTOM_ACTIVE), - TextureFactory.builder().addIcon(STEAM_TURBINE_BOTTOM_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getBottomActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(STEAM_TURBINE_BOTTOM_ACTIVE), + TextureFactory.builder() + .addIcon(STEAM_TURBINE_BOTTOM_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], TextureFactory.of( - TextureFactory.of(STEAM_TURBINE_TOP_ACTIVE), - TextureFactory.builder().addIcon(STEAM_TURBINE_TOP_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getTopActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(STEAM_TURBINE_TOP_ACTIVE), + TextureFactory.builder() + .addIcon(STEAM_TURBINE_TOP_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], TextureFactory.of( - TextureFactory.of(STEAM_TURBINE_SIDE_ACTIVE), - TextureFactory.builder().addIcon(STEAM_TURBINE_SIDE_ACTIVE_GLOW).glow().build())}; + return new ITexture[] { + super.getSidesActive(aColor)[0], + TextureFactory.of( + TextureFactory.of(STEAM_TURBINE_SIDE_ACTIVE), + TextureFactory.builder() + .addIcon(STEAM_TURBINE_SIDE_ACTIVE_GLOW) + .glow() + .build()) + }; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Bronze.java index c62145be13..b3da47ae89 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Bronze.java @@ -9,7 +9,8 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_N import gregtech.api.render.TextureFactory; public class GT_MetaTileEntity_BasicHull_Bronze extends GT_MetaTileEntity_BasicHull_NonElectric { - public GT_MetaTileEntity_BasicHull_Bronze(int aID, String aName, String aNameRegional, int aTier, String aDescription) { + public GT_MetaTileEntity_BasicHull_Bronze( + int aID, String aName, String aNameRegional, int aTier, String aDescription) { super(aID, aName, aNameRegional, aTier, aDescription); } @@ -17,7 +18,8 @@ public class GT_MetaTileEntity_BasicHull_Bronze extends GT_MetaTileEntity_BasicH super(aName, aTier, aDescription, aTextures); } - public GT_MetaTileEntity_BasicHull_Bronze(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_BasicHull_Bronze( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -30,9 +32,15 @@ public class GT_MetaTileEntity_BasicHull_Bronze extends GT_MetaTileEntity_BasicH public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[3][17][]; for (byte i = -1; i < 16; i = (byte) (i + 1)) { - rTextures[0][(i + 1)] = new ITexture[]{TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZE_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[1][(i + 1)] = new ITexture[]{TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZE_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[2][(i + 1)] = new ITexture[]{TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZE_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + rTextures[0][(i + 1)] = new ITexture[] { + TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZE_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; + rTextures[1][(i + 1)] = new ITexture[] { + TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZE_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; + rTextures[2][(i + 1)] = new ITexture[] { + TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZE_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; } return rTextures; } diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_BronzeBricks.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_BronzeBricks.java index 90ec54b1fa..0589f8f236 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_BronzeBricks.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_BronzeBricks.java @@ -9,32 +9,44 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_N import gregtech.api.render.TextureFactory; public class GT_MetaTileEntity_BasicHull_BronzeBricks extends GT_MetaTileEntity_BasicHull_NonElectric { - public GT_MetaTileEntity_BasicHull_BronzeBricks(int aID, String aName, String aNameRegional, int aTier, String aDescription) { + public GT_MetaTileEntity_BasicHull_BronzeBricks( + int aID, String aName, String aNameRegional, int aTier, String aDescription) { super(aID, aName, aNameRegional, aTier, aDescription); } - public GT_MetaTileEntity_BasicHull_BronzeBricks(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_BasicHull_BronzeBricks( + String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } - public GT_MetaTileEntity_BasicHull_BronzeBricks(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_BasicHull_BronzeBricks( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_BasicHull_BronzeBricks(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_BasicHull_BronzeBricks( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[3][17][]; for (byte i = -1; i < 16; i = (byte) (i + 1)) { - ITexture[] tmp0 = {TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp0 = { + TextureFactory.of( + Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; rTextures[0][(i + 1)] = tmp0; - ITexture[] tmp1 = {TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp1 = { + TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; rTextures[1][(i + 1)] = tmp1; - ITexture[] tmp2 = {TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp2 = { + TextureFactory.of( + Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; rTextures[2][(i + 1)] = tmp2; } return rTextures; diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java index 24c3f589e8..d8d8cfed63 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java @@ -8,7 +8,9 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric; import gregtech.api.render.TextureFactory; -public class GT_MetaTileEntity_BasicHull_Steel extends GT_MetaTileEntity_BasicHull_NonElectric { public GT_MetaTileEntity_BasicHull_Steel(int aID, String aName, String aNameRegional, int aTier, String aDescription) { +public class GT_MetaTileEntity_BasicHull_Steel extends GT_MetaTileEntity_BasicHull_NonElectric { + public GT_MetaTileEntity_BasicHull_Steel( + int aID, String aName, String aNameRegional, int aTier, String aDescription) { super(aID, aName, aNameRegional, aTier, aDescription); } @@ -29,11 +31,17 @@ public class GT_MetaTileEntity_BasicHull_Steel extends GT_MetaTileEntity_BasicHu public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[3][17][]; for (byte i = -1; i < 16; i = (byte) (i + 1)) { - ITexture[] tmp0 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp0 = { + TextureFactory.of(Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; rTextures[0][(i + 1)] = tmp0; - ITexture[] tmp1 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEEL_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp1 = { + TextureFactory.of(Textures.BlockIcons.MACHINE_STEEL_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; rTextures[1][(i + 1)] = tmp1; - ITexture[] tmp2 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp2 = { + TextureFactory.of(Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; rTextures[2][(i + 1)] = tmp2; } return rTextures; diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_SteelBricks.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_SteelBricks.java index 57ef19478e..2a0827e278 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_SteelBricks.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_SteelBricks.java @@ -9,32 +9,43 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_N import gregtech.api.render.TextureFactory; public class GT_MetaTileEntity_BasicHull_SteelBricks extends GT_MetaTileEntity_BasicHull_NonElectric { - public GT_MetaTileEntity_BasicHull_SteelBricks(int aID, String aName, String aNameRegional, int aTier, String aDescription) { + public GT_MetaTileEntity_BasicHull_SteelBricks( + int aID, String aName, String aNameRegional, int aTier, String aDescription) { super(aID, aName, aNameRegional, aTier, aDescription); } - public GT_MetaTileEntity_BasicHull_SteelBricks(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_BasicHull_SteelBricks( + String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } - public GT_MetaTileEntity_BasicHull_SteelBricks(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_BasicHull_SteelBricks( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_BasicHull_SteelBricks(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_BasicHull_SteelBricks( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[3][17][]; for (byte i = -1; i < 16; i = (byte) (i + 1)) { - ITexture[] tmp0 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp0 = { + TextureFactory.of( + Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; rTextures[0][(i + 1)] = tmp0; - ITexture[] tmp1 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEELBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp1 = { + TextureFactory.of(Textures.BlockIcons.MACHINE_STEELBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; rTextures[1][(i + 1)] = tmp1; - ITexture[] tmp2 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp2 = { + TextureFactory.of(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)) + }; rTextures[2][(i + 1)] = tmp2; } return rTextures; diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java index ec747a79f3..1ae3381662 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java @@ -1,11 +1,7 @@ package gregtech.common.tileentities.machines; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_INPUT_HATCH; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_INPUT_HATCH_ACTIVE; import appeng.api.config.Actionable; import appeng.api.config.PowerMultiplier; @@ -31,27 +27,31 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input import gregtech.api.render.TextureFactory; import gregtech.common.gui.GT_Container_InputBus_ME; import gregtech.common.gui.GT_GUIContainer_InputBus_ME; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_INPUT_HATCH; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_INPUT_HATCH_ACTIVE; - -public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch_InputBus implements IConfigurationCircuitSupport { +public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch_InputBus + implements IConfigurationCircuitSupport { private static final int SLOT_COUNT = 16; private BaseActionSource requestSource = null; private AENetworkProxy gridProxy = null; private final ItemStack[] shadowInventory = new ItemStack[SLOT_COUNT]; private final int[] savedStackSizes = new int[SLOT_COUNT]; private boolean processingRecipe = false; + public GT_MetaTileEntity_Hatch_InputBus_ME(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 1, SLOT_COUNT * 2 + 1, new String[] { - "Advanced item input for Multiblocks", - "Retrieves directly from ME", - "Keeps 16 item types in stock" + "Advanced item input for Multiblocks", "Retrieves directly from ME", "Keeps 16 item types in stock" }); disableSort = true; } - public GT_MetaTileEntity_Hatch_InputBus_ME(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_InputBus_ME( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, SLOT_COUNT * 2 + 1, aDescription, aTextures); disableSort = true; } @@ -93,16 +93,18 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch return isOutputFacing((byte) forgeDirection.ordinal()) ? AECableType.SMART : AECableType.NONE; } - @Override @Optional.Method(modid = "appliedenergistics2") public AENetworkProxy getProxy() { if (gridProxy == null) { if (getBaseMetaTileEntity() instanceof IGridProxyable) { - gridProxy = new AENetworkProxy((IGridProxyable) getBaseMetaTileEntity(), "proxy", ItemList.Hatch_Output_Bus_ME.get(1), true); + gridProxy = new AENetworkProxy( + (IGridProxyable) getBaseMetaTileEntity(), "proxy", ItemList.Hatch_Output_Bus_ME.get(1), true); gridProxy.setFlags(GridFlags.REQUIRE_CHANNEL); if (getBaseMetaTileEntity().getWorld() != null) - gridProxy.setOwner(getBaseMetaTileEntity().getWorld().getPlayerEntityByName(getBaseMetaTileEntity().getOwnerName())); + gridProxy.setOwner(getBaseMetaTileEntity() + .getWorld() + .getPlayerEntityByName(getBaseMetaTileEntity().getOwnerName())); } } return this.gridProxy; @@ -110,16 +112,13 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch @Override @Optional.Method(modid = "appliedenergistics2") - public void gridChanged() { - } + public void gridChanged() {} @Override - public void saveNBTData(NBTTagCompound aNBT) - { + public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); int[] sizes = new int[16]; - for (int i = 0; i < 16; ++i) - sizes[i] = mInventory[i + 16] == null ? 0 : mInventory[i + 16].stackSize; + for (int i = 0; i < 16; ++i) sizes[i] = mInventory[i + 16] == null ? 0 : mInventory[i + 16].stackSize; aNBT.setIntArray("sizes", sizes); if (GregTech_API.mAE2) { gridProxy.writeToNBT(aNBT); @@ -155,14 +154,15 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch public String[] getInfoData() { if (GregTech_API.mAE2) { return new String[] { - "The bus is " + ((getProxy() != null && getProxy().isActive()) ? - EnumChatFormatting.GREEN + "online" : EnumChatFormatting.RED + "offline" + getAEDiagnostics()) - + EnumChatFormatting.RESET}; - } - else - return new String[] {}; + "The bus is " + + ((getProxy() != null && getProxy().isActive()) + ? EnumChatFormatting.GREEN + "online" + : EnumChatFormatting.RED + "offline" + getAEDiagnostics()) + + EnumChatFormatting.RESET + }; + } else return new String[] {}; } - + @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return false; @@ -174,15 +174,15 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - } + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {} @Override - public void updateSlots() { - } + public void updateSlots() {} @Override - public int getCircuitSlot() { return SLOT_COUNT * 2; } + public int getCircuitSlot() { + return SLOT_COUNT * 2; + } @Override public int getCircuitSlotX() { @@ -196,15 +196,12 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch @Override public ItemStack getStackInSlot(int aIndex) { - if (!processingRecipe) - return super.getStackInSlot(aIndex); - if (aIndex < 0 || aIndex > mInventory.length) - return null; + if (!processingRecipe) return super.getStackInSlot(aIndex); + if (aIndex < 0 || aIndex > mInventory.length) return null; if (aIndex >= SLOT_COUNT && aIndex < SLOT_COUNT * 2) - //Display slots + // Display slots return null; - if (aIndex == getCircuitSlot()) - return mInventory[aIndex]; + if (aIndex == getCircuitSlot()) return mInventory[aIndex]; if (GregTech_API.mAE2 && mInventory[aIndex] != null) { AENetworkProxy proxy = getProxy(); if (proxy == null) { @@ -221,17 +218,15 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch this.setInventorySlotContents(aIndex + SLOT_COUNT, this.shadowInventory[aIndex]); return this.shadowInventory[aIndex]; } else { - //Request failed + // Request failed this.setInventorySlotContents(aIndex + SLOT_COUNT, null); return null; } - } - catch( final GridAccessException ignored ) - { + } catch (final GridAccessException ignored) { } return null; } else { - //AE available but no items requested + // AE available but no items requested this.setInventorySlotContents(aIndex + SLOT_COUNT, null); } return mInventory[aIndex]; @@ -239,8 +234,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch @Optional.Method(modid = "appliedenergistics2") private BaseActionSource getRequestSource() { - if (requestSource == null) - requestSource = new MachineSource((IActionHost)getBaseMetaTileEntity()); + if (requestSource == null) requestSource = new MachineSource((IActionHost) getBaseMetaTileEntity()); return requestSource; } @@ -267,10 +261,11 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch IAEItemStack request = AEItemStack.create(mInventory[i]); request.setStackSize(savedStackSizes[i] - (oldStack == null ? 0 : oldStack.stackSize)); sg.extractItems(request, Actionable.MODULATE, getRequestSource()); - proxy.getEnergy().extractAEPower(request.getStackSize(), Actionable.MODULATE, PowerMultiplier.CONFIG); + proxy.getEnergy() + .extractAEPower( + request.getStackSize(), Actionable.MODULATE, PowerMultiplier.CONFIG); setInventorySlotContents(i + SLOT_COUNT, oldStack); - } - catch (final GridAccessException ignored) { + } catch (final GridAccessException ignored) { } } savedStackSizes[i] = 0; @@ -285,8 +280,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch if (GregTech_API.mAE2 && aIndex >= 0 && aIndex < SLOT_COUNT) { if (aStack == null) { super.setInventorySlotContents(aIndex + SLOT_COUNT, null); - } - else { + } else { AENetworkProxy proxy = getProxy(); if (!proxy.isActive()) { super.setInventorySlotContents(aIndex + SLOT_COUNT, null); @@ -300,8 +294,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch ItemStack s = (result != null) ? result.getItemStack() : null; setInventorySlotContents(aIndex + SLOT_COUNT, s); return s; - } - catch (final GridAccessException ignored) { + } catch (final GridAccessException ignored) { } } } diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java index 4389156191..21b4aabe3a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java @@ -1,7 +1,7 @@ package gregtech.common.tileentities.machines; -import java.util.ArrayList; -import java.util.List; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_HATCH; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_HATCH_ACTIVE; import appeng.api.AEApi; import appeng.api.networking.GridFlags; @@ -28,6 +28,8 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; @@ -37,27 +39,32 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_HATCH; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_HATCH_ACTIVE; - public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatch_OutputBus { private BaseActionSource requestSource = null; private AENetworkProxy gridProxy = null; - IItemList<IAEItemStack> itemCache = GregTech_API.mAE2 ? AEApi.instance().storage().createItemList() : null; + IItemList<IAEItemStack> itemCache = + GregTech_API.mAE2 ? AEApi.instance().storage().createItemList() : null; long lastOutputTick = 0; long tickCounter = 0; boolean lastOutputFailed = false; boolean infiniteCache = true; public GT_MetaTileEntity_Hatch_OutputBus_ME(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 1, new String[]{ - "Item Output for Multiblocks", "Stores directly into ME", - "To use in GT++ multiblocks", " turn off overflow control", - " with a soldering iron." - }, 0); + super( + aID, + aName, + aNameRegional, + 1, + new String[] { + "Item Output for Multiblocks", "Stores directly into ME", + "To use in GT++ multiblocks", " turn off overflow control", + " with a soldering iron." + }, + 0); } - public GT_MetaTileEntity_Hatch_OutputBus_ME(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_OutputBus_ME( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); } @@ -68,12 +75,12 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_ME_HATCH_ACTIVE)}; + return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_ME_HATCH_ACTIVE)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_ME_HATCH)}; + return new ITexture[] {aBaseTexture, TextureFactory.of(OVERLAY_ME_HATCH)}; } @Override @@ -84,8 +91,7 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc @Override public boolean storeAll(ItemStack aStack) { - if (!GregTech_API.mAE2) - return false; + if (!GregTech_API.mAE2) return false; aStack.stackSize = store(aStack); return aStack.stackSize == 0; } @@ -98,23 +104,21 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc */ @Optional.Method(modid = "appliedenergistics2") public int store(final ItemStack stack) { - if (!infiniteCache && lastOutputFailed) - return stack.stackSize; + if (!infiniteCache && lastOutputFailed) return stack.stackSize; itemCache.add(AEApi.instance().storage().createItemStack(stack)); return 0; } @Optional.Method(modid = "appliedenergistics2") private BaseActionSource getRequest() { - if (requestSource == null) - requestSource = new MachineSource((IActionHost)getBaseMetaTileEntity()); + if (requestSource == null) requestSource = new MachineSource((IActionHost) getBaseMetaTileEntity()); return requestSource; } @Override @Optional.Method(modid = "appliedenergistics2") public AECableType getCableConnectionType(ForgeDirection forgeDirection) { - return isOutputFacing((byte)forgeDirection.ordinal()) ? AECableType.SMART : AECableType.NONE; + return isOutputFacing((byte) forgeDirection.ordinal()) ? AECableType.SMART : AECableType.NONE; } @Override @@ -124,10 +128,16 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (!getBaseMetaTileEntity().getCoverBehaviorAtSideNew(aSide).isGUIClickable(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), getBaseMetaTileEntity())) - return; + if (!getBaseMetaTileEntity() + .getCoverBehaviorAtSideNew(aSide) + .isGUIClickable( + aSide, + getBaseMetaTileEntity().getCoverIDAtSide(aSide), + getBaseMetaTileEntity().getComplexCoverDataAtSide(aSide), + getBaseMetaTileEntity())) return; infiniteCache = !infiniteCache; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.hatch.infiniteCache." + infiniteCache)); + GT_Utility.sendChatToPlayer( + aPlayer, StatCollector.translateToLocal("GT5U.hatch.infiniteCache." + infiniteCache)); } @Override @@ -135,24 +145,24 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc public AENetworkProxy getProxy() { if (gridProxy == null) { if (getBaseMetaTileEntity() instanceof IGridProxyable) { - gridProxy = new AENetworkProxy((IGridProxyable)getBaseMetaTileEntity(), "proxy", ItemList.Hatch_Output_Bus_ME.get(1), true); + gridProxy = new AENetworkProxy( + (IGridProxyable) getBaseMetaTileEntity(), "proxy", ItemList.Hatch_Output_Bus_ME.get(1), true); gridProxy.setFlags(GridFlags.REQUIRE_CHANNEL); if (getBaseMetaTileEntity().getWorld() != null) - gridProxy.setOwner(getBaseMetaTileEntity().getWorld().getPlayerEntityByName(getBaseMetaTileEntity().getOwnerName())); + gridProxy.setOwner(getBaseMetaTileEntity() + .getWorld() + .getPlayerEntityByName(getBaseMetaTileEntity().getOwnerName())); } - } return this.gridProxy; } @Override @Optional.Method(modid = "appliedenergistics2") - public void gridChanged() { - } + public void gridChanged() {} @Optional.Method(modid = "appliedenergistics2") - private void flushCachedStack() - { + private void flushCachedStack() { lastOutputFailed = false; AENetworkProxy proxy = getProxy(); if (proxy == null) { @@ -161,9 +171,8 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc } try { IMEMonitor<IAEItemStack> sg = proxy.getStorage().getItemInventory(); - for (IAEItemStack s: itemCache) { - if (s.getStackSize() == 0) - continue; + for (IAEItemStack s : itemCache) { + if (s.getStackSize() == 0) continue; IAEItemStack rest = Platform.poweredInsert(proxy.getEnergy(), sg, s, getRequest()); if (rest != null && rest.getStackSize() > 0) { lastOutputFailed = true; @@ -172,9 +181,7 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc } s.setStackSize(0); } - } - catch( final GridAccessException ignored ) - { + } catch (final GridAccessException ignored) { lastOutputFailed = true; } lastOutputTick = tickCounter; @@ -184,22 +191,19 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (GT_Values.GT.isServerSide()) { tickCounter = aTick; - if (tickCounter > (lastOutputTick + 40)) - flushCachedStack(); + if (tickCounter > (lastOutputTick + 40)) flushCachedStack(); } super.onPostTick(aBaseMetaTileEntity, aTick); } @Override - public void saveNBTData(NBTTagCompound aNBT) - { + public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); if (GregTech_API.mAE2) { NBTTagList items = new NBTTagList(); - for (IAEItemStack s: itemCache) { - if (s.getStackSize() == 0) - continue; + for (IAEItemStack s : itemCache) { + if (s.getStackSize() == 0) continue; NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tagItemStack = new NBTTagCompound(); s.getItemStack().writeToNBT(tagItemStack); @@ -222,15 +226,17 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc itemCache.add(AEApi.instance().storage().createItemStack(GT_Utility.loadItem((NBTTagCompound) t))); t = aNBT.getTag("cachedItems"); if (t instanceof NBTTagList) { - NBTTagList l = (NBTTagList)t; + NBTTagList l = (NBTTagList) t; for (int i = 0; i < l.tagCount(); ++i) { NBTTagCompound tag = l.getCompoundTagAt(i); if (!tag.hasKey("itemStack")) { // legacy #868 - itemCache.add(AEApi.instance().storage().createItemStack(GT_Utility.loadItem(l.getCompoundTagAt(i)))); + itemCache.add( + AEApi.instance().storage().createItemStack(GT_Utility.loadItem(l.getCompoundTagAt(i)))); continue; } NBTTagCompound tagItemStack = tag.getCompoundTag("itemStack"); - final IAEItemStack s = AEApi.instance().storage().createItemStack(GT_Utility.loadItem(tagItemStack)); + final IAEItemStack s = + AEApi.instance().storage().createItemStack(GT_Utility.loadItem(tagItemStack)); s.setStackSize(tag.getLong("size")); itemCache.add(s); } @@ -250,22 +256,22 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc @Override public String[] getInfoData() { - if (!GregTech_API.mAE2) - return new String[]{}; + if (!GregTech_API.mAE2) return new String[] {}; List<String> ss = new ArrayList<>(); - ss.add("The bus is " + ((getProxy() != null && getProxy().isActive())? - EnumChatFormatting.GREEN + "online" : EnumChatFormatting.RED + "offline" - + getAEDiagnostics() ) + EnumChatFormatting.RESET); + ss.add("The bus is " + + ((getProxy() != null && getProxy().isActive()) + ? EnumChatFormatting.GREEN + "online" + : EnumChatFormatting.RED + "offline" + getAEDiagnostics()) + + EnumChatFormatting.RESET); if (itemCache.isEmpty()) { ss.add("The bus has no cached items"); - } - else { + } else { IWideReadableNumberConverter nc = ReadableNumberConverter.INSTANCE; ss.add(String.format("The bus contains %d cached stacks: ", itemCache.size())); int counter = 0; for (IAEItemStack s : itemCache) { - ss.add(s.getItem().getItemStackDisplayName(s.getItemStack()) + ": " + - EnumChatFormatting.GOLD + nc.toWideReadableForm(s.getStackSize()) + EnumChatFormatting.RESET); + ss.add(s.getItem().getItemStackDisplayName(s.getItemStack()) + ": " + EnumChatFormatting.GOLD + + nc.toWideReadableForm(s.getStackSize()) + EnumChatFormatting.RESET); if (++counter > 100) break; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java index 10bfd92f37..ee2ddcdfed 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; + import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -14,6 +17,10 @@ import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; import ic2.core.Ic2Items; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -24,15 +31,6 @@ import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; - -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; - - public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_BasicMachine { boolean ready = false; int radius; @@ -40,60 +38,91 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba int cX; int cZ; - public GT_MetaTileEntity_AdvSeismicProspector(int aID, String aName, String aNameRegional, int aTier, int aRadius, int aStep) { - super(aID, aName, aNameRegional, aTier, 1, // amperage + public GT_MetaTileEntity_AdvSeismicProspector( + int aID, String aName, String aNameRegional, int aTier, int aRadius, int aStep) { + super( + aID, + aName, + aNameRegional, + aTier, + 1, // amperage "", 1, // input slot count 1, // output slot count "Default.png", // GUI name "", // NEI name - TextureFactory.of( - TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW) + .glow() + .build())); radius = aRadius; step = aStep; } @Override public String[] getDescription() { - return new String[]{ - "Place, activate with explosives", - "2 Powderbarrels, " - + "4 Glyceryl Trinitrate, " - + "16 TNT, or " - + "8 ITNT", - "Use Data Stick, Scan Data Stick, Print Data Stick, Bind Pages into Book", - "Ore prospecting area = " - + radius*2 - + "x" - + radius*2 - + " ONLY blocks below prospector", - "Oil prospecting area 3x3 oilfields, each is 8x8 chunks"}; + return new String[] { + "Place, activate with explosives", + "2 Powderbarrels, " + "4 Glyceryl Trinitrate, " + "16 TNT, or " + "8 ITNT", + "Use Data Stick, Scan Data Stick, Print Data Stick, Bind Pages into Book", + "Ore prospecting area = " + radius * 2 + "x" + radius * 2 + " ONLY blocks below prospector", + "Oil prospecting area 3x3 oilfields, each is 8x8 chunks" + }; } - protected GT_MetaTileEntity_AdvSeismicProspector(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, - String aGUIName, String aNEIName, int aRadius, int aStep) { + protected GT_MetaTileEntity_AdvSeismicProspector( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName, + int aRadius, + int aStep) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); radius = aRadius; step = aStep; @@ -101,8 +130,15 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_AdvSeismicProspector(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, - this.mGUIName, this.mNEIName, this.radius, this.step); + return new GT_MetaTileEntity_AdvSeismicProspector( + this.mName, + this.mTier, + this.mDescriptionArray, + this.mTextures, + this.mGUIName, + this.mNEIName, + this.radius, + this.step); } @Override @@ -110,16 +146,19 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba if (aBaseMetaTileEntity.isServerSide()) { ItemStack aStack = aPlayer.getCurrentEquippedItem(); - if (!ready && (GT_Utility.consumeItems(aPlayer, aStack, Item.getItemFromBlock(Blocks.tnt), 16) - || GT_Utility.consumeItems(aPlayer, aStack, Ic2Items.industrialTnt.getItem(), 8) - || GT_Utility.consumeItems(aPlayer, aStack, Materials.Glyceryl, 4) - || GT_Utility.consumeItems(aPlayer, aStack, ItemList.Block_Powderbarrel.getItem(), 2) )) { + if (!ready + && (GT_Utility.consumeItems(aPlayer, aStack, Item.getItemFromBlock(Blocks.tnt), 16) + || GT_Utility.consumeItems(aPlayer, aStack, Ic2Items.industrialTnt.getItem(), 8) + || GT_Utility.consumeItems(aPlayer, aStack, Materials.Glyceryl, 4) + || GT_Utility.consumeItems(aPlayer, aStack, ItemList.Block_Powderbarrel.getItem(), 2))) { this.ready = true; this.mMaxProgresstime = (aPlayer.capabilities.isCreativeMode ? 20 : 800); - } else if (ready && mMaxProgresstime == 0 - && aStack != null && aStack.stackSize == 1 + } else if (ready + && mMaxProgresstime == 0 + && aStack != null + && aStack.stackSize == 1 && aStack.getItem() == ItemList.Tool_DataStick.getItem()) { this.ready = false; @@ -132,15 +171,16 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba ArrayList<String> tOils = new ArrayList<>(); prospectOils(tOils); - GT_Utility.ItemNBT.setAdvancedProspectionData(mTier, - aStack, - this.getBaseMetaTileEntity().getXCoord(), - this.getBaseMetaTileEntity().getYCoord(), - this.getBaseMetaTileEntity().getZCoord(), - this.getBaseMetaTileEntity().getWorld().provider.dimensionId, - tOils, - GT_Utility.sortByValueToList(tOres), - radius); + GT_Utility.ItemNBT.setAdvancedProspectionData( + mTier, + aStack, + this.getBaseMetaTileEntity().getXCoord(), + this.getBaseMetaTileEntity().getYCoord(), + this.getBaseMetaTileEntity().getZCoord(), + this.getBaseMetaTileEntity().getWorld().provider.dimensionId, + tOils, + GT_Utility.sortByValueToList(tOres), + radius); } } @@ -165,15 +205,14 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba for (int i = 0; i < oilfieldSize; i++) { for (int j = 0; j < oilfieldSize; j++) { - Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords( - xChunk + i + x * oilfieldSize, - zChunk + j + z * oilfieldSize); + Chunk tChunk = getBaseMetaTileEntity() + .getWorld() + .getChunkFromChunkCoords( + xChunk + i + x * oilfieldSize, zChunk + j + z * oilfieldSize); FluidStack tFluid = undergroundOilReadInformation(tChunk); if (tFluid != null) { - if (tFluid.amount > max) - max = tFluid.amount; - if (tFluid.amount < min) - min = tFluid.amount; + if (tFluid.amount > max) max = tFluid.amount; + if (tFluid.amount < min) min = tFluid.amount; if (!tFluids.containsKey(cInts)) { tFluids.put(cInts, tFluid); } @@ -181,33 +220,32 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba } } - aOils.add(++oilFieldCount + "," + min + "-" + max + "," + tFluids.get(cInts).getLocalizedName()); + aOils.add(++oilFieldCount + "," + min + "-" + max + "," + + tFluids.get(cInts).getLocalizedName()); } } - } catch (Exception ignored) {} + } catch (Exception ignored) { + } } private void prospectOres(Map<String, Integer> aOres) { int tLeftXBound = this.getBaseMetaTileEntity().getXCoord() - radius; - int tRightXBound = tLeftXBound + 2*radius; + int tRightXBound = tLeftXBound + 2 * radius; int tLeftZBound = this.getBaseMetaTileEntity().getZCoord() - radius; - int tRightZBound = tLeftZBound + 2*radius; + int tRightZBound = tLeftZBound + 2 * radius; for (int i = tLeftXBound; i <= tRightXBound; i += step) { - if (Math.abs(i >> 4) % 3 != 1) - continue; + if (Math.abs(i >> 4) % 3 != 1) continue; for (int k = tLeftZBound; k <= tRightZBound; k += step) { - if (Math.abs(k >> 4) % 3 != 1) - continue; + if (Math.abs(k >> 4) % 3 != 1) continue; cX = (i >> 4) << 4; cZ = (k >> 4) << 4; - String separator = (cX +8)+ "," + (cZ + 8) + " --------"; + String separator = (cX + 8) + "," + (cZ + 8) + " --------"; aOres.put(separator, 1); prospectHole(i, k, aOres); - } } } @@ -216,8 +254,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba String tFoundOre; for (int j = this.getBaseMetaTileEntity().getYCoord(); j > 0; j--) { tFoundOre = checkForOre(i, j, k); - if (tFoundOre != null) - countOre(aOres, tFoundOre, cX, cZ); + if (tFoundOre != null) countOre(aOres, tFoundOre, cX, cZ); } } @@ -228,12 +265,11 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba TileEntity tTileEntity = getBaseMetaTileEntity().getWorld().getTileEntity(x, y, z); if ((tTileEntity instanceof GT_TileEntity_Ores) - && (((GT_TileEntity_Ores) tTileEntity).mMetaData < 16000)) { // Filtering small ores - Materials tMaterial - = GregTech_API.sGeneratedMaterials[((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000]; + && (((GT_TileEntity_Ores) tTileEntity).mMetaData < 16000)) { // Filtering small ores + Materials tMaterial = + GregTech_API.sGeneratedMaterials[((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000]; - if ((tMaterial != null) && (tMaterial != Materials._NULL)) - return tMaterial.mDefaultLocalName; + if ((tMaterial != null) && (tMaterial != Materials._NULL)) return tMaterial.mDefaultLocalName; } } else { int tMetaID = getBaseMetaTileEntity().getWorld().getBlockMetadata(x, y, z); @@ -241,14 +277,13 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba ItemData association = GT_OreDictUnificator.getAssociation(is); if ((association != null) && (association.mPrefix.toString().startsWith("ore"))) return association.mMaterial.mMaterial.mDefaultLocalName; - else if (GT_Utility.isOre(tBlock, tMetaID)) - return tBlock.getLocalizedName(); + else if (GT_Utility.isOre(tBlock, tMetaID)) return tBlock.getLocalizedName(); } return null; } private static void countOre(Map<String, Integer> map, String ore, int cCX, int cCZ) { - ore = (cCX +8)+ "," + (cCZ + 8) + " has " + ore; + ore = (cCX + 8) + "," + (cCZ + 8) + " has " + ore; Integer oldCount = map.get(ore); oldCount = (oldCount == null) ? 0 : oldCount; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java index c0d4616bf9..49b6e4d473 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.ItemList; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -11,52 +13,92 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine { ItemStack aInputCache; ItemStack aOutputCache; int aTypeCache = 0; public GT_MetaTileEntity_Boxinator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Puts things into Boxes", 2, 1, "Packager.png", "", + super( + aID, + aName, + aNameRegional, + aTier, + 1, + "Puts things into Boxes", + 2, + 1, + "Packager.png", + "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_BOXINATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_BOXINATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_BOXINATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_BOXINATOR), - TextureFactory.builder().addIcon(OVERLAY_SIDE_BOXINATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_BOXINATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_BOXINATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_BOXINATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_BOXINATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_BOXINATOR), - TextureFactory.builder().addIcon(OVERLAY_FRONT_BOXINATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_BOXINATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_BOXINATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_BOXINATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_BOXINATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_BOXINATOR), - TextureFactory.builder().addIcon(OVERLAY_TOP_BOXINATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_BOXINATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_BOXINATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_BOXINATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_BOXINATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_BOXINATOR), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_BOXINATOR_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_BOXINATOR_GLOW) + .glow() + .build())); } - public GT_MetaTileEntity_Boxinator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Boxinator( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 2, 1, aGUIName, aNEIName); } - public GT_MetaTileEntity_Boxinator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Boxinator( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 2, 1, aGUIName, aNEIName); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Boxinator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + return new GT_MetaTileEntity_Boxinator( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } @Override @@ -64,13 +106,12 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes; } - private boolean hasValidCache(ItemStack mItem,int mType,boolean mClearOnFailure) { + private boolean hasValidCache(ItemStack mItem, int mType, boolean mClearOnFailure) { if (aInputCache != null && aOutputCache != null && aTypeCache == mType && aInputCache.isItemEqual(mItem) - && ItemStack.areItemStackTagsEqual(mItem,aInputCache)) - return true; + && ItemStack.areItemStackTagsEqual(mItem, aInputCache)) return true; // clear cache if it was invalid if (mClearOnFailure) { aInputCache = null; @@ -80,7 +121,7 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine return false; } - private void cacheItem(ItemStack mInputItem,ItemStack mOutputItem,int mType) { + private void cacheItem(ItemStack mInputItem, ItemStack mOutputItem, int mType) { aTypeCache = mType; aOutputCache = mOutputItem.copy(); aInputCache = mInputItem.copy(); @@ -94,53 +135,57 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine } ItemStack tSlot0 = getInputAt(0); ItemStack tSlot1 = getInputAt(1); - if ((GT_Utility.isStackValid(tSlot0)) && (GT_Utility.isStackValid(tSlot1)) && (GT_Utility.getContainerItem(tSlot0, true) == null)) { + if ((GT_Utility.isStackValid(tSlot0)) + && (GT_Utility.isStackValid(tSlot1)) + && (GT_Utility.getContainerItem(tSlot0, true) == null)) { if ((ItemList.Schematic_1by1.isStackEqual(tSlot1)) && (tSlot0.stackSize >= 1)) { - boolean tIsCached = hasValidCache(tSlot0,1,true); + boolean tIsCached = hasValidCache(tSlot0, 1, true); this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(tSlot0); if (this.mOutputItems[0] != null) { if (canOutput(this.mOutputItems[0])) { tSlot0.stackSize -= 1; - calculateOverclockedNess(32,16); - //In case recipe is too OP for that machine + calculateOverclockedNess(32, 16); + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - if (!tIsCached) - cacheItem(tSlot0,this.mOutputItems[0],1); + if (!tIsCached) cacheItem(tSlot0, this.mOutputItems[0], 1); return FOUND_AND_SUCCESSFULLY_USED_RECIPE; } } return DID_NOT_FIND_RECIPE; } if ((ItemList.Schematic_2by2.isStackEqual(tSlot1)) && (getInputAt(0).stackSize >= 4)) { - boolean tIsCached = hasValidCache(tSlot0,2,true); - this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(tSlot0, tSlot0, null, tSlot0, tSlot0); + boolean tIsCached = hasValidCache(tSlot0, 2, true); + this.mOutputItems[0] = tIsCached + ? aOutputCache.copy() + : GT_ModHandler.getRecipeOutput(tSlot0, tSlot0, null, tSlot0, tSlot0); if (this.mOutputItems[0] != null) { if (canOutput(this.mOutputItems[0])) { getInputAt(0).stackSize -= 4; - calculateOverclockedNess(32,32); - //In case recipe is too OP for that machine + calculateOverclockedNess(32, 32); + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - if (!tIsCached) - cacheItem(tSlot0,this.mOutputItems[0],2); + if (!tIsCached) cacheItem(tSlot0, this.mOutputItems[0], 2); return FOUND_AND_SUCCESSFULLY_USED_RECIPE; } } return DID_NOT_FIND_RECIPE; } if ((ItemList.Schematic_3by3.isStackEqual(tSlot1)) && (getInputAt(0).stackSize >= 9)) { - boolean tIsCached = hasValidCache(tSlot0,3,true); - this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0); + boolean tIsCached = hasValidCache(tSlot0, 3, true); + this.mOutputItems[0] = tIsCached + ? aOutputCache.copy() + : GT_ModHandler.getRecipeOutput( + tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0); if (this.mOutputItems[0] != null) { if (canOutput(this.mOutputItems[0])) { getInputAt(0).stackSize -= 9; - calculateOverclockedNess(32,64); - //In case recipe is too OP for that machine + calculateOverclockedNess(32, 64); + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - if (!tIsCached) - cacheItem(tSlot0,this.mOutputItems[0],3); + if (!tIsCached) cacheItem(tSlot0, this.mOutputItems[0], 3); return FOUND_AND_SUCCESSFULLY_USED_RECIPE; } } @@ -151,23 +196,36 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { if (!super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) { return false; } ItemStack tInput1 = getInputAt(1); - if ((ItemList.Schematic_1by1.isStackEqual(tInput1)) || (ItemList.Schematic_2by2.isStackEqual(tInput1)) || (ItemList.Schematic_3by3.isStackEqual(tInput1))) { - if (hasValidCache(aStack,aTypeCache,false)) - return true; - if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[mTier], null, GT_Utility.copyAmount(64L, aStack), tInput1) != null) { + if ((ItemList.Schematic_1by1.isStackEqual(tInput1)) + || (ItemList.Schematic_2by2.isStackEqual(tInput1)) + || (ItemList.Schematic_3by3.isStackEqual(tInput1))) { + if (hasValidCache(aStack, aTypeCache, false)) return true; + if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe( + getBaseMetaTileEntity(), + true, + gregtech.api.enums.GT_Values.V[mTier], + null, + GT_Utility.copyAmount(64L, aStack), + tInput1) + != null) { return true; } if (ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(aStack) != null) return true; - if (ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(aStack, aStack, null, aStack, aStack) != null) { + if (ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) + && GT_ModHandler.getRecipeOutput(aStack, aStack, null, aStack, aStack) != null) { return true; } - return ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) && (GT_ModHandler.getRecipeOutput(aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack) != null); + return ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) + && (GT_ModHandler.getRecipeOutput( + aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack) + != null); } else { return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Charger.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Charger.java index b614bc598e..f6223a4a0d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Charger.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Charger.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.GT_Values.V; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -9,19 +11,20 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatter import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; -import static gregtech.api.enums.GT_Values.V; - public class GT_MetaTileEntity_Charger extends GT_MetaTileEntity_BasicBatteryBuffer { - public GT_MetaTileEntity_Charger(int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) { + public GT_MetaTileEntity_Charger( + int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) { super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount); } - public GT_MetaTileEntity_Charger(String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) { + public GT_MetaTileEntity_Charger( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) { super(aName, aTier, aDescription, aTextures, aSlotCount); } - public GT_MetaTileEntity_Charger(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aSlotCount) { + public GT_MetaTileEntity_Charger( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aSlotCount) { super(aName, aTier, aDescription, aTextures, aSlotCount); } @@ -36,16 +39,18 @@ public class GT_MetaTileEntity_Charger extends GT_MetaTileEntity_BasicBatteryBuf } @Override - public long maxEUStore() { return V[mTier] * 256L * mInventory.length;} + public long maxEUStore() { + return V[mTier] * 256L * mInventory.length; + } @Override public long maxAmperesIn() { - return Math.max(mChargeableCount * 8L,4L); + return Math.max(mChargeableCount * 8L, 4L); } @Override public long maxAmperesOut() { - return Math.max(mBatteryCount * 4L,2L); + return Math.max(mBatteryCount * 4L, 2L); } @Override @@ -56,25 +61,50 @@ public class GT_MetaTileEntity_Charger extends GT_MetaTileEntity_BasicBatteryBuf BaseMetaTileEntity mBaseMetaTileEntity = (BaseMetaTileEntity) getBaseMetaTileEntity(); if (mBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity) { MetaTileEntity mMetaTileEntity = (MetaTileEntity) mBaseMetaTileEntity.getMetaTileEntity(); - //for (int t = 0; t < 6; t++) { - if (mMetaTileEntity.dechargerSlotCount() > 0 && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) { - for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { - if (mMetaTileEntity.mInventory[i] != null && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) { - mBaseMetaTileEntity.increaseStoredEnergyUnits(GT_ModHandler.dischargeElectricItem(mMetaTileEntity.mInventory[i], GT_Utility.safeInt(Math.min(V[mTier] * 15, mBaseMetaTileEntity.getEUCapacity() - mBaseMetaTileEntity.getStoredEU())), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), true, false, false), true); - if (mMetaTileEntity.mInventory[i].stackSize <= 0) - mMetaTileEntity.mInventory[i] = null; + // for (int t = 0; t < 6; t++) { + if (mMetaTileEntity.dechargerSlotCount() > 0 + && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) { + for (int i = mMetaTileEntity.dechargerSlotStartIndex(), + k = mMetaTileEntity.dechargerSlotCount() + i; + i < k; + i++) { + if (mMetaTileEntity.mInventory[i] != null + && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) { + mBaseMetaTileEntity.increaseStoredEnergyUnits( + GT_ModHandler.dischargeElectricItem( + mMetaTileEntity.mInventory[i], + GT_Utility.safeInt(Math.min( + V[mTier] * 15, + mBaseMetaTileEntity.getEUCapacity() + - mBaseMetaTileEntity.getStoredEU())), + (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), + true, + false, + false), + true); + if (mMetaTileEntity.mInventory[i].stackSize <= 0) mMetaTileEntity.mInventory[i] = null; } } } if (mMetaTileEntity.rechargerSlotCount() > 0 && mBaseMetaTileEntity.getStoredEU() > 0) { - for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { + for (int i = mMetaTileEntity.rechargerSlotStartIndex(), + k = mMetaTileEntity.rechargerSlotCount() + i; + i < k; + i++) { if (mBaseMetaTileEntity.getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) { - mBaseMetaTileEntity.decreaseStoredEU(GT_ModHandler.chargeElectricItem(mMetaTileEntity.mInventory[i], GT_Utility.safeInt(Math.min(V[mTier] * 15, mBaseMetaTileEntity.getStoredEU())), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getOutputTier()), true, false), true); - if (mMetaTileEntity.mInventory[i].stackSize <= 0) - mMetaTileEntity.mInventory[i] = null; + mBaseMetaTileEntity.decreaseStoredEU( + GT_ModHandler.chargeElectricItem( + mMetaTileEntity.mInventory[i], + GT_Utility.safeInt( + Math.min(V[mTier] * 15, mBaseMetaTileEntity.getStoredEU())), + (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getOutputTier()), + true, + false), + true); + if (mMetaTileEntity.mInventory[i].stackSize <= 0) mMetaTileEntity.mInventory[i] = null; } } - //} + // } } } } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java index d249cae2a1..dc5c976eac 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java @@ -1,6 +1,5 @@ package gregtech.common.tileentities.machines.basic; - import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_1by1; @@ -19,32 +18,63 @@ import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_CuringOven(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Heats tools for hardening", 1, 1, "E_Oven.png", "", TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM"))); + super( + aID, + aName, + aNameRegional, + aTier, + 1, + "Heats tools for hardening", + 1, + 1, + "E_Oven.png", + "", + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE_ACTIVE")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE")), + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT_ACTIVE")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP_ACTIVE")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP")), + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM_ACTIVE")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM"))); } - public GT_MetaTileEntity_CuringOven(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_CuringOven( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } - public GT_MetaTileEntity_CuringOven(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_CuringOven( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_CuringOven(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + return new GT_MetaTileEntity_CuringOven( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return (super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ItemList.Cell_Empty.isStackEqual(aStack); + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return (super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack)) + && ItemList.Cell_Empty.isStackEqual(aStack); } @Override public boolean isFluidInputAllowed(FluidStack aFluid) { return false; } - + @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity); @@ -59,30 +89,34 @@ public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { for (ItemStack tStack : mInventory) - if (tStack!=null&&tStack.getItem() instanceof GT_MetaGenerated_Tool &&getBaseMetaTileEntity().getStoredEU()>0) { - getBaseMetaTileEntity().decreaseStoredEnergyUnits(24, true); + if (tStack != null + && tStack.getItem() instanceof GT_MetaGenerated_Tool + && getBaseMetaTileEntity().getStoredEU() > 0) { + getBaseMetaTileEntity().decreaseStoredEnergyUnits(24, true); NBTTagCompound aNBT = tStack.getTagCompound(); if (aNBT != null) { - int tHeat = 300; - long tWorldTime = getBaseMetaTileEntity().getWorld().getTotalWorldTime(); + int tHeat = 300; + long tWorldTime = getBaseMetaTileEntity().getWorld().getTotalWorldTime(); aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if (aNBT != null&&aNBT.hasKey("Heat")) { - tHeat = aNBT.getInteger("Heat"); - if(aNBT.hasKey("HeatTime")){ - long tHeatTime = aNBT.getLong("HeatTime"); - if(tWorldTime>(tHeatTime+10)){ - tHeat = (int) (tHeat - ((tWorldTime-tHeatTime)/10)); - if(tHeat<300)tHeat=300; - } - } + if (aNBT != null && aNBT.hasKey("Heat")) { + tHeat = aNBT.getInteger("Heat"); + if (aNBT.hasKey("HeatTime")) { + long tHeatTime = aNBT.getLong("HeatTime"); + if (tWorldTime > (tHeatTime + 10)) { + tHeat = (int) (tHeat - ((tWorldTime - tHeatTime) / 10)); + if (tHeat < 300) tHeat = 300; + } + } } tHeat++; - if(aNBT!=null){ - aNBT.setInteger("Heat", tHeat); - aNBT.setLong("HeatTime", tWorldTime);} - if(tHeat>GT_MetaGenerated_Tool.getPrimaryMaterial(tStack).mMeltingPoint){mInventory[0]=null;} + if (aNBT != null) { + aNBT.setInteger("Heat", tHeat); + aNBT.setLong("HeatTime", tWorldTime); + } + if (tHeat > GT_MetaGenerated_Tool.getPrimaryMaterial(tStack).mMeltingPoint) { + mInventory[0] = null; + } } - } } } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java index 318acbea51..1f9b93a8d2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.GT_Values.MOD_ID_RC; +import static gregtech.api.enums.Textures.BlockIcons.*; + import com.google.common.collect.ArrayListMultimap; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; @@ -22,19 +25,15 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.extensions.ArrayExt; import ic2.api.item.IC2Items; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import java.util.stream.IntStream; - -import static gregtech.api.enums.GT_Values.MOD_ID_RC; -import static gregtech.api.enums.Textures.BlockIcons.*; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachine { @@ -45,7 +44,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi aNameRegional, aTier, 1, - new String[]{ + new String[] { "Disassembles Machines up to " + GT_Values.TIER_COLORS[aTier] + GT_Values.VOLTAGE_NAMES[aTier], "Can also disassemble most assembler recipes!" }, @@ -54,77 +53,103 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi "Disassembler.png", "", - //Textures + // Textures TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_DISASSEMBLER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_DISASSEMBLER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_DISASSEMBLER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_DISASSEMBLER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_DISASSEMBLER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_DISASSEMBLER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_DISASSEMBLER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISASSEMBLER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISASSEMBLER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_DISASSEMBLER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISASSEMBLER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISASSEMBLER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_DISASSEMBLER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_DISASSEMBLER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_DISASSEMBLER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_DISASSEMBLER), - TextureFactory.builder().addIcon(OVERLAY_TOP_DISASSEMBLER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_DISASSEMBLER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_DISASSEMBLER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_DISASSEMBLER_GLOW).glow().build()) - ); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_DISASSEMBLER_GLOW) + .glow() + .build())); } - public GT_MetaTileEntity_Disassembler(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Disassembler( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 9, aGUIName, aNEIName); } - public GT_MetaTileEntity_Disassembler(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Disassembler( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 9, aGUIName, aNEIName); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Disassembler(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + return new GT_MetaTileEntity_Disassembler( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } private static final ItemStack[][] alwaysReplace = { - { - //ItemStack to look for - new ItemStack(Blocks.trapped_chest, 1, OreDictionary.WILDCARD_VALUE) - }, - { - //ItemStack to replace - new ItemStack(Blocks.chest) - } + { + // ItemStack to look for + new ItemStack(Blocks.trapped_chest, 1, OreDictionary.WILDCARD_VALUE) + }, + { + // ItemStack to replace + new ItemStack(Blocks.chest) + } }; private static final Object[][] OreDictionaryOverride = { - { - //String to look for - "plankWood", - "stoneCobble", - "gemDiamond", - "logWood", - "stickWood", - "treeSapling" - }, - { - //ItemStack to replace - new ItemStack(Blocks.planks), - new ItemStack(Blocks.cobblestone), - new ItemStack(Items.diamond), - new ItemStack(Blocks.log), - new ItemStack(Items.stick), - new ItemStack(Blocks.sapling) - } + { + // String to look for + "plankWood", "stoneCobble", "gemDiamond", "logWood", "stickWood", "treeSapling" + }, + { + // ItemStack to replace + new ItemStack(Blocks.planks), + new ItemStack(Blocks.cobblestone), + new ItemStack(Items.diamond), + new ItemStack(Blocks.log), + new ItemStack(Items.stick), + new ItemStack(Blocks.sapling) + } }; public static ArrayListMultimap<GT_ItemStack, ItemStack> getOutputHardOverrides() { @@ -141,7 +166,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi static { outputHardOverrides = ArrayListMultimap.create(); - outputHardOverrides.put(new GT_ItemStack(new ItemStack(Blocks.torch,6)), new ItemStack(Items.stick)); + outputHardOverrides.put(new GT_ItemStack(new ItemStack(Blocks.torch, 6)), new ItemStack(Items.stick)); addBlacklist(ItemList.Casing_Coil_Superconductor.get(1L)); addBlacklist(Materials.Graphene.getDust(1)); addBlacklist(ItemList.Circuit_Parts_Vacuum_Tube.get(1L)); @@ -179,34 +204,24 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi return false; } - private boolean compareToUnpacker(ItemStack is){ - return null != GT_Recipe.GT_Recipe_Map.sUnboxinatorRecipes.findRecipe( - null, - true, - true, - Long.MAX_VALUE, - null, - is); + private boolean compareToUnpacker(ItemStack is) { + return null + != GT_Recipe.GT_Recipe_Map.sUnboxinatorRecipes.findRecipe(null, true, true, Long.MAX_VALUE, null, is); } @Override public int checkRecipe() { ItemStack is = getInputAt(0); - if (GT_Utility.isStackInvalid(is)) - return DID_NOT_FIND_RECIPE; + if (GT_Utility.isStackInvalid(is)) return DID_NOT_FIND_RECIPE; - if ( - is.getItem() instanceof GT_MetaGenerated_Tool + if (is.getItem() instanceof GT_MetaGenerated_Tool || isCircuit(is) || blackList.stream().anyMatch(t -> GT_Utility.areStacksEqual(t.toStack(), is, true)) - || compareToUnpacker(is) - ) - return DID_NOT_FIND_RECIPE; + || compareToUnpacker(is)) return DID_NOT_FIND_RECIPE; Integer handleHardOverride = handleHardOverride(is); - if (handleHardOverride != null) - return handleHardOverride; + if (handleHardOverride != null) return handleHardOverride; return process(); } @@ -230,24 +245,22 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi if (is.getItem() == comp.getItem()) { IMetaTileEntity iMetaTileEntity = GregTech_API.METATILEENTITIES[is.getItemDamage()]; - return iMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock && - ((GT_MetaTileEntity_TieredMachineBlock) iMetaTileEntity).mTier > this.mTier; + return iMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock + && ((GT_MetaTileEntity_TieredMachineBlock) iMetaTileEntity).mTier > this.mTier; } return false; } - private int process(){ + private int process() { int statusCode = onTheFlyGeneration(); - if (statusCode != DID_NOT_FIND_RECIPE) - return statusCode; + if (statusCode != DID_NOT_FIND_RECIPE) return statusCode; return checkRecipeMap(); } private int onTheFlyGeneration() { Collection<DissassembleReference> recipes = this.findRecipeFromMachine(); - if (recipes.isEmpty()) - return DID_NOT_FIND_RECIPE; + if (recipes.isEmpty()) return DID_NOT_FIND_RECIPE; DissassembleReference recipe = ensureDowncasting(recipes); @@ -264,16 +277,15 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi private void removeInvalidStacks(DissassembleReference recipe) { for (int i = 0; i < recipe.inputs.length; i++) - if (GT_Utility.isStackInvalid(recipe.inputs[i]) || recipe.inputs[i].stackSize < 1) - recipe.inputs[i] = null; + if (GT_Utility.isStackInvalid(recipe.inputs[i]) || recipe.inputs[i].stackSize < 1) recipe.inputs[i] = null; recipe.inputs = ArrayExt.withoutNulls(recipe.inputs, ItemStack[]::new); } private int checkRecipeMap() { - GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe(this.getBaseMetaTileEntity(), true, this.maxEUInput(), null, this.getAllInputs()); - if (gt_recipe == null) - return DID_NOT_FIND_RECIPE; + GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe( + this.getBaseMetaTileEntity(), true, this.maxEUInput(), null, this.getAllInputs()); + if (gt_recipe == null) return DID_NOT_FIND_RECIPE; if (gt_recipe.isRecipeInputEqual(false, null, this.getAllInputs())) { if (gt_recipe.mSpecialValue == -100) { // Bypass standard disassembler restrictions. @@ -292,52 +304,43 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } - private boolean setOutputsAndTime(ItemStack[] inputs, int stackSize){ + private boolean setOutputsAndTime(ItemStack[] inputs, int stackSize) { ItemStack machineInput = this.getInputAt(0); - if (checkTier(machineInput)) - return false; + if (checkTier(machineInput)) return false; - if (machineInput.stackSize >= stackSize) - machineInput.stackSize -= stackSize; - else - return false; + if (machineInput.stackSize >= stackSize) machineInput.stackSize -= stackSize; + else return false; System.arraycopy(inputs, 0, this.mOutputItems, 0, inputs.length); - this.calculateOverclockedNess(30,600); + this.calculateOverclockedNess(30, 600); return true; } private static DissassembleReference ensureDowncasting(Collection<? extends DissassembleReference> recipes) { - ItemStack[] inputs = recipes.stream() - .findFirst() - .orElseThrow(NullPointerException::new) - .inputs; - int EUt = recipes.stream() - .findFirst() - .orElseThrow(NullPointerException::new) - .EUt; + ItemStack[] inputs = recipes.stream().findFirst().orElseThrow(NullPointerException::new).inputs; + int EUt = recipes.stream().findFirst().orElseThrow(NullPointerException::new).EUt; ItemStack[] output = new ItemStack[inputs.length]; List<GT_Recipe> recipesColl = null; if (recipes.size() > 1) - recipesColl = recipes.stream() - .skip(1) - .map(x -> x.recipe) - .collect(Collectors.toList()); + recipesColl = recipes.stream().skip(1).map(x -> x.recipe).collect(Collectors.toList()); handleRecipeTransformation(inputs, output, recipesColl); - return new DissassembleReference(recipes.stream().mapToInt(x -> x.stackSize).min().orElseThrow(NumberFormatException::new), output, null, EUt); + return new DissassembleReference( + recipes.stream().mapToInt(x -> x.stackSize).min().orElseThrow(NumberFormatException::new), + output, + null, + EUt); } - private static void handleRecipeTransformation(ItemStack[] inputs, ItemStack[] output, List<? extends GT_Recipe> recipesColl) { + private static void handleRecipeTransformation( + ItemStack[] inputs, ItemStack[] output, List<? extends GT_Recipe> recipesColl) { for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++) { Set<ItemStack[]> inputsStacks = null; if (recipesColl != null) - inputsStacks = recipesColl.stream() - .map(x -> x.mInputs) - .collect(Collectors.toSet()); + inputsStacks = recipesColl.stream().map(x -> x.mInputs).collect(Collectors.toSet()); handleRecipeTransformationInternal(inputs, output, inputsStacks, i); } addOthersAndHandleAlwaysReplace(inputs, output); @@ -346,13 +349,15 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi /** * Public Interface for ReverseRecipes, do not call inside of this class. */ - public static void handleRecipeTransformation(ItemStack[] inputs, ItemStack[] output, Set<ItemStack[]> inputsStacks) { + public static void handleRecipeTransformation( + ItemStack[] inputs, ItemStack[] output, Set<ItemStack[]> inputsStacks) { for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++) handleRecipeTransformationInternal(inputs, output, inputsStacks, i); addOthersAndHandleAlwaysReplace(inputs, output); } - private static void handleRecipeTransformationInternal(ItemStack[] inputs, ItemStack[] output, Set<ItemStack[]> inputsStacks, int i) { + private static void handleRecipeTransformationInternal( + ItemStack[] inputs, ItemStack[] output, Set<ItemStack[]> inputsStacks, int i) { ItemStack input = inputs[i]; ItemData data = GT_OreDictUnificator.getItemData(input); if (data == null || data.mMaterial == null || data.mMaterial.mMaterial == null || data.mPrefix == null) { @@ -362,17 +367,16 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi handleReplacement(inputsStacks, data, output, input, i); } - private static void addOthersAndHandleAlwaysReplace(ItemStack[] inputs, ItemStack[] output){ + private static void addOthersAndHandleAlwaysReplace(ItemStack[] inputs, ItemStack[] output) { for (int i = 0; i < inputs.length; i++) { - //Adds rest of Items - if (output[i] == null) - output[i] = inputs[i]; + // Adds rest of Items + if (output[i] == null) output[i] = inputs[i]; - //Math.min the recipe output if Items are the same + // Math.min the recipe output if Items are the same if (GT_Utility.areStacksEqual(output[i], inputs[i])) output[i].stackSize = Math.min(output[i].stackSize, inputs[i].stackSize); - //Handles replacement Overrides + // Handles replacement Overrides ItemStack[] itemStacks = alwaysReplace[0]; for (int j = 0; j < itemStacks.length; j++) { ItemStack x = itemStacks[j]; @@ -382,9 +386,9 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } } - //Unification + // Unification output[i] = handleUnification(output[i]); - //Wildcard + // Wildcard output[i] = handleWildcard(output[i]); } } @@ -392,7 +396,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi private static ItemStack handleUnification(ItemStack stack) { for (int oreID : OreDictionary.getOreIDs(stack)) { for (int i = 0; i < OreDictionaryOverride[0].length; i++) - if (OreDictionary.getOreName(oreID).equals(OreDictionaryOverride[0][i])){ + if (OreDictionary.getOreName(oreID).equals(OreDictionaryOverride[0][i])) { ItemStack ret = ((ItemStack) OreDictionaryOverride[1][i]).copy(); ret.stackSize = stack.stackSize; return ret; @@ -402,20 +406,22 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } private static ItemStack handleWildcard(ItemStack stack) { - if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE && !stack.getItem().isDamageable()) { + if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE + && !stack.getItem().isDamageable()) { stack.setItemDamage(0); } return stack; } - private static void handleReplacement(Set<ItemStack[]> inputsStacks, ItemData data, ItemStack[] output, ItemStack input, int i){ + private static void handleReplacement( + Set<ItemStack[]> inputsStacks, ItemData data, ItemStack[] output, ItemStack input, int i) { AtomicReference<Materials> toRpl = new AtomicReference<>(); Materials first = data.mMaterial.mMaterial; if (inputsStacks != null) { handleInputStacks(inputsStacks, toRpl, data, first, i); } if (toRpl.get() == null) { - //Remove Magnetic and Annealed Modifiers + // Remove Magnetic and Annealed Modifiers handleBetterMaterialsVersions(data, toRpl); } if (toRpl.get() != null) { @@ -427,27 +433,29 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } } - private static void handleInputStacks(Set<ItemStack[]> inputsStacks, AtomicReference<? super Materials> toRpl, ItemData data, Materials first, int i){ + private static void handleInputStacks( + Set<ItemStack[]> inputsStacks, + AtomicReference<? super Materials> toRpl, + ItemData data, + Materials first, + int i) { final int finalIndex = i; inputsStacks.forEach(stackArray -> { ItemData dataAgainst = GT_OreDictUnificator.getItemData(stackArray[finalIndex]); - if ( - dataAgainst == null || - dataAgainst.mMaterial == null || - dataAgainst.mMaterial.mMaterial == null || - dataAgainst.mPrefix == null || - dataAgainst.mPrefix != data.mPrefix - ) { + if (dataAgainst == null + || dataAgainst.mMaterial == null + || dataAgainst.mMaterial.mMaterial == null + || dataAgainst.mPrefix == null + || dataAgainst.mPrefix != data.mPrefix) { return; } handleDifferentMaterialsOnRecipes(first, dataAgainst.mMaterial.mMaterial, toRpl); - handleAnyMaterials(first,toRpl); + handleAnyMaterials(first, toRpl); }); } - private static void handleAnyMaterials(Materials first, AtomicReference<? super Materials> toRpl){ - if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyIron))) - toRpl.set(Materials.Iron); + private static void handleAnyMaterials(Materials first, AtomicReference<? super Materials> toRpl) { + if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyIron))) toRpl.set(Materials.Iron); else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyCopper))) toRpl.set(Materials.Copper); else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyRubber))) @@ -458,35 +466,27 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi toRpl.set(Materials.Rubber); } - private static void handleDifferentMaterialsOnRecipes(Materials first, Materials second, AtomicReference<? super Materials> toRpl){ + private static void handleDifferentMaterialsOnRecipes( + Materials first, Materials second, AtomicReference<? super Materials> toRpl) { if (!first.equals(second)) - if (first.equals(Materials.Aluminium) && second.equals(Materials.Iron)) - toRpl.set(second); - else if (first.equals(Materials.Steel) && second.equals(Materials.Iron)) - toRpl.set(second); - else if (first.equals(Materials.WroughtIron) && second.equals(Materials.Iron)) - toRpl.set(second); + if (first.equals(Materials.Aluminium) && second.equals(Materials.Iron)) toRpl.set(second); + else if (first.equals(Materials.Steel) && second.equals(Materials.Iron)) toRpl.set(second); + else if (first.equals(Materials.WroughtIron) && second.equals(Materials.Iron)) toRpl.set(second); else if (first.equals(Materials.Aluminium) && second.equals(Materials.WroughtIron)) toRpl.set(Materials.Iron); - else if (first.equals(Materials.Aluminium) && second.equals(Materials.Steel)) - toRpl.set(second); + else if (first.equals(Materials.Aluminium) && second.equals(Materials.Steel)) toRpl.set(second); else if (first.equals(Materials.Polytetrafluoroethylene) && second.equals(Materials.Plastic)) toRpl.set(second); - else if (first.equals(Materials.Polybenzimidazole) && second.equals(Materials.Plastic)) - toRpl.set(second); - else if (first.equals(Materials.Polystyrene) && second.equals(Materials.Plastic)) - toRpl.set(second); - else if (first.equals(Materials.Silicone) && second.equals(Materials.Plastic)) - toRpl.set(second); - else if (first.equals(Materials.NetherQuartz) || first.equals(Materials.CertusQuartz) && second.equals(Materials.Quartzite)) - toRpl.set(second); - else if (first.equals(Materials.Plastic) && second.equals(Materials.Wood)) - toRpl.set(second); - else if (first.equals(Materials.Diamond) && second.equals(Materials.Glass)) - toRpl.set(second); + else if (first.equals(Materials.Polybenzimidazole) && second.equals(Materials.Plastic)) toRpl.set(second); + else if (first.equals(Materials.Polystyrene) && second.equals(Materials.Plastic)) toRpl.set(second); + else if (first.equals(Materials.Silicone) && second.equals(Materials.Plastic)) toRpl.set(second); + else if (first.equals(Materials.NetherQuartz) + || first.equals(Materials.CertusQuartz) && second.equals(Materials.Quartzite)) toRpl.set(second); + else if (first.equals(Materials.Plastic) && second.equals(Materials.Wood)) toRpl.set(second); + else if (first.equals(Materials.Diamond) && second.equals(Materials.Glass)) toRpl.set(second); } - private static void handleBetterMaterialsVersions(ItemData data, AtomicReference<? super Materials> toRpl){ + private static void handleBetterMaterialsVersions(ItemData data, AtomicReference<? super Materials> toRpl) { if (Materials.SteelMagnetic.equals(data.mMaterial.mMaterial)) { toRpl.set(Materials.Steel); } else if (Materials.IronMagnetic.equals(data.mMaterial.mMaterial)) { @@ -501,27 +501,18 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } @SuppressWarnings("deprecation") - private static void handleCircuits(Materials first, ItemStack[] output, ItemStack input, int i){ - if (first.equals(Materials.Primitive)) - output[i] = ItemList.NandChip.get(input.stackSize); - else if (first.equals(Materials.Basic)) - output[i] = ItemList.Circuit_Microprocessor.get(input.stackSize); - else if (first.equals(Materials.Good)) - output[i] = ItemList.Circuit_Good.get(input.stackSize); - else if (first.equals(Materials.Advanced)) - output[i] = ItemList.Circuit_Advanced.get(input.stackSize); - else if (first.equals(Materials.Data)) - output[i] = ItemList.Circuit_Data.get(input.stackSize); - else if (first.equals(Materials.Master)) - output[i] = ItemList.Circuit_Master.get(input.stackSize); - else if (first.equals(Materials.Ultimate)) - output[i] = ItemList.Circuit_Quantummainframe.get(input.stackSize); + private static void handleCircuits(Materials first, ItemStack[] output, ItemStack input, int i) { + if (first.equals(Materials.Primitive)) output[i] = ItemList.NandChip.get(input.stackSize); + else if (first.equals(Materials.Basic)) output[i] = ItemList.Circuit_Microprocessor.get(input.stackSize); + else if (first.equals(Materials.Good)) output[i] = ItemList.Circuit_Good.get(input.stackSize); + else if (first.equals(Materials.Advanced)) output[i] = ItemList.Circuit_Advanced.get(input.stackSize); + else if (first.equals(Materials.Data)) output[i] = ItemList.Circuit_Data.get(input.stackSize); + else if (first.equals(Materials.Master)) output[i] = ItemList.Circuit_Master.get(input.stackSize); + else if (first.equals(Materials.Ultimate)) output[i] = ItemList.Circuit_Quantummainframe.get(input.stackSize); else if (first.equals(Materials.Superconductor)) output[i] = ItemList.Circuit_Crystalmainframe.get(input.stackSize); - else if (first.equals(Materials.Infinite)) - output[i] = ItemList.Circuit_Wetwaremainframe.get(input.stackSize); - else if (first.equals(Materials.Bio)) - output[i] = ItemList.Circuit_Biomainframe.get(input.stackSize); + else if (first.equals(Materials.Infinite)) output[i] = ItemList.Circuit_Wetwaremainframe.get(input.stackSize); + else if (first.equals(Materials.Bio)) output[i] = ItemList.Circuit_Biomainframe.get(input.stackSize); } static class DissassembleReference { @@ -551,47 +542,48 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi private Collection<DissassembleReference> findRecipeFromMachine() { ItemStack is = getInputAt(0); - if (GT_Utility.isStackInvalid(is)) - return Collections.emptySet(); + if (GT_Utility.isStackInvalid(is)) return Collections.emptySet(); AtomicInteger stacksize = new AtomicInteger(); - //Check Recipe Maps for creation of Item + // Check Recipe Maps for creation of Item List<DissassembleReference> possibleRecipes = GT_Recipe.GT_Recipe_Map.sAssemblerRecipes.mRecipeList.stream() - .filter(x -> Arrays.stream(x.mOutputs) - .anyMatch(y -> - { - ItemStack out = is.copy(); - out.stackSize = y.stackSize; - boolean isDone = GT_Utility.areStacksEqual(y, out, true) && y.stackSize <= is.stackSize; - if (isDone) - stacksize.set(y.stackSize); - return isDone; - }) - ) + .filter(x -> Arrays.stream(x.mOutputs).anyMatch(y -> { + ItemStack out = is.copy(); + out.stackSize = y.stackSize; + boolean isDone = GT_Utility.areStacksEqual(y, out, true) && y.stackSize <= is.stackSize; + if (isDone) stacksize.set(y.stackSize); + return isDone; + })) .map(x -> new DissassembleReference(stacksize.get(), x.mInputs, x)) .collect(Collectors.toList()); - //Is there only one way to create it? - if (possibleRecipes.size() == 1) - return possibleRecipes; + // Is there only one way to create it? + if (possibleRecipes.size() == 1) return possibleRecipes; - //There are Multiple Ways -> Get recipe with cheapest inputs - //More Inputs should mean cheaper Materials - return possibleRecipes - .stream() + // There are Multiple Ways -> Get recipe with cheapest inputs + // More Inputs should mean cheaper Materials + return possibleRecipes.stream() .sorted(Comparator.comparingDouble(GT_MetaTileEntity_Disassembler::getCheaperInputs)) .collect(Collectors.toList()); } - private static double getCheaperInputs(GT_MetaTileEntity_Disassembler.DissassembleReference x){ - double fluidInputValueRaw = Arrays.stream(x.recipe.mFluidInputs).flatMapToInt(f -> IntStream.of(f.amount)).sum(); + private static double getCheaperInputs(GT_MetaTileEntity_Disassembler.DissassembleReference x) { + double fluidInputValueRaw = Arrays.stream(x.recipe.mFluidInputs) + .flatMapToInt(f -> IntStream.of(f.amount)) + .sum(); fluidInputValueRaw = fluidInputValueRaw > 0 ? fluidInputValueRaw : 144D; - double inputValue = Arrays.stream(x.inputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() + - (fluidInputValueRaw / 144D); - double fluidOutputValueRaw = Arrays.stream(x.recipe.mFluidOutputs).flatMapToInt(f -> IntStream.of(f.amount)).sum(); + double inputValue = Arrays.stream(x.inputs) + .flatMapToInt(f -> IntStream.of(f.stackSize)) + .sum() + + (fluidInputValueRaw / 144D); + double fluidOutputValueRaw = Arrays.stream(x.recipe.mFluidOutputs) + .flatMapToInt(f -> IntStream.of(f.amount)) + .sum(); fluidOutputValueRaw = fluidOutputValueRaw > 0 ? fluidOutputValueRaw : 144D; - double outputValue = Arrays.stream(x.recipe.mOutputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() + - (fluidOutputValueRaw / 144D); + double outputValue = Arrays.stream(x.recipe.mOutputs) + .flatMapToInt(f -> IntStream.of(f.stackSize)) + .sum() + + (fluidOutputValueRaw / 144D); return outputValue / inputValue; } @@ -600,7 +592,10 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && aStack.getTagCompound() != null && aStack.getTagCompound().getCompoundTag("GT.CraftingComponents") != null; + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + && aStack.getTagCompound() != null + && aStack.getTagCompound().getCompoundTag("GT.CraftingComponents") != null; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java index faa1df8ebe..09ad7ddbf3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_IndustrialApiary.java @@ -1,5 +1,9 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; + import com.google.common.collect.ImmutableSet; import com.mojang.authlib.GameProfile; import cpw.mods.fml.relauncher.Side; @@ -22,6 +26,10 @@ import gregtech.api.util.GT_Utility; import gregtech.common.GT_Client; import gregtech.common.gui.GT_Container_IndustrialApiary; import gregtech.common.gui.GT_GUIContainer_IndustrialApiary; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.*; import net.bdew.gendustry.api.ApiaryModifiers; import net.bdew.gendustry.api.items.IApiaryUpgrade; import net.minecraft.block.Block; @@ -36,22 +44,13 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.*; - -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; - -public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicMachine implements IBeeHousing, IBeeHousingInventory, IErrorLogic, IBeeModifier, IBeeListener { +public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicMachine + implements IBeeHousing, IBeeHousingInventory, IErrorLogic, IBeeModifier, IBeeListener { public static final int baseEUtUsage = 37; static final int queen = 5; static final int drone = 6; - IBeeRoot beeRoot = (IBeeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootBees"); public int mSpeed = 0; @@ -62,47 +61,90 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM private IEffectData[] effectData = new IEffectData[2]; public GT_MetaTileEntity_IndustrialApiary(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 4, new String[] { "BEES GOES BRRRR", EnumChatFormatting.GRAY + "Added by " + EnumChatFormatting.GOLD + "kuba6000" }, 6, 9, "IndustrialApiary.png", "", + super( + aID, + aName, + aNameRegional, + aTier, + 4, + new String[] { + "BEES GOES BRRRR", EnumChatFormatting.GRAY + "Added by " + EnumChatFormatting.GOLD + "kuba6000" + }, + 6, + 9, + "IndustrialApiary.png", + "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_INDUSTRIAL_APIARY_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_INDUSTRIAL_APIARY_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_INDUSTRIAL_APIARY_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_INDUSTRIAL_APIARY), - TextureFactory.builder().addIcon(OVERLAY_SIDE_INDUSTRIAL_APIARY_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_INDUSTRIAL_APIARY_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_INDUSTRIAL_APIARY_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_INDUSTRIAL_APIARY_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_INDUSTRIAL_APIARY_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_INDUSTRIAL_APIARY), - TextureFactory.builder().addIcon(OVERLAY_FRONT_INDUSTRIAL_APIARY_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_INDUSTRIAL_APIARY_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_INDUSTRIAL_APIARY_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_INDUSTRIAL_APIARY_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_INDUSTRIAL_APIARY_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_INDUSTRIAL_APIARY), - TextureFactory.builder().addIcon(OVERLAY_TOP_INDUSTRIAL_APIARY_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_INDUSTRIAL_APIARY_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_INDUSTRIAL_APIARY_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_INDUSTRIAL_APIARY_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_INDUSTRIAL_APIARY_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_INDUSTRIAL_APIARY), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_INDUSTRIAL_APIARY_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_INDUSTRIAL_APIARY_GLOW) + .glow() + .build())); } - public GT_MetaTileEntity_IndustrialApiary(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_IndustrialApiary( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 4, aDescription, aTextures, 6, 9, aGUIName, aNEIName); } - public GT_MetaTileEntity_IndustrialApiary(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_IndustrialApiary( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 4, aDescription, aTextures, 6, 9, aGUIName, aNEIName); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_IndustrialApiary(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + return new GT_MetaTileEntity_IndustrialApiary( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } - @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_Container_IndustrialApiary(aPlayerInventory, aBaseMetaTileEntity); @@ -118,8 +160,7 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM super.saveNBTData(aNBT); aNBT.setInteger("mSpeed", mSpeed); aNBT.setBoolean("mLockedSpeed", mLockedSpeed); - if(usedQueen != null) - aNBT.setTag("usedQueen", usedQueen.writeToNBT(new NBTTagCompound())); + if (usedQueen != null) aNBT.setTag("usedQueen", usedQueen.writeToNBT(new NBTTagCompound())); aNBT.setBoolean("retrievingPollenInThisOperation", retrievingPollenInThisOperation); aNBT.setInteger("pollinationDelay", pollinationDelay); } @@ -129,9 +170,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM super.loadNBTData(aNBT); mSpeed = aNBT.getInteger("mSpeed"); mLockedSpeed = aNBT.getBoolean("mLockedSpeed"); - if(aNBT.hasKey("usedQueen")) - usedQueen = ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("usedQueen")); - retrievingPollenInThisOperation = aNBT.getBoolean("retrievingPollenInThisOperation"); + if (aNBT.hasKey("usedQueen")) usedQueen = ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("usedQueen")); + retrievingPollenInThisOperation = aNBT.getBoolean("retrievingPollenInThisOperation"); pollinationDelay = aNBT.getInteger("pollinationDelay"); } @@ -142,12 +182,11 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public int checkRecipe() { updateModifiers(); - if(canWork()) { + if (canWork()) { ItemStack queen = getQueen(); usedQueen = queen.copy(); - if(beeRoot.getType(queen) == EnumBeeType.QUEEN) - { + if (beeRoot.getType(queen) == EnumBeeType.QUEEN) { IBee bee = beeRoot.getMember(queen); usedQueenBee = bee; @@ -159,23 +198,27 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM mod *= beemodifier.getLifespanModifier(null, null, 1.f); int h = bee.getHealth(); mod = 1.f / mod; - float cycles = h/mod; - + float cycles = h / mod; // PRODUCTS HashMap<GT_Utility.ItemId, ItemStack> pollen = new HashMap<>(); - if(isRetrievingPollen && floweringMod > 0f) { - int icycles = (int)cycles + (getWorld().rand.nextFloat() < (cycles - (float)((int)cycles)) ? 1 : 0); - for(int z = 0; z < icycles; z++) { + if (isRetrievingPollen && floweringMod > 0f) { + int icycles = + (int) cycles + (getWorld().rand.nextFloat() < (cycles - (float) ((int) cycles)) ? 1 : 0); + for (int z = 0; z < icycles; z++) { IIndividual p = bee.retrievePollen(this); - if(p != null) - { - ItemStack s = p.getGenome().getSpeciesRoot().getMemberStack(p, EnumGermlingType.POLLEN.ordinal()); - if(s != null) { + if (p != null) { + ItemStack s = + p.getGenome().getSpeciesRoot().getMemberStack(p, EnumGermlingType.POLLEN.ordinal()); + if (s != null) { GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(s); - pollen.computeIfAbsent(id, k -> { ItemStack ns = s.copy(); ns.stackSize = 0; return ns; }); + pollen.computeIfAbsent(id, k -> { + ItemStack ns = s.copy(); + ns.stackSize = 0; + return ns; + }); pollen.get(id).stackSize += s.stackSize; } } @@ -185,29 +228,45 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM retrievedpollen = null; retrievingPollenInThisOperation = isRetrievingPollen; - IBeeGenome genome = bee.getGenome(); + IBeeGenome genome = bee.getGenome(); IAlleleBeeSpecies primary = genome.getPrimary(); IAlleleBeeSpecies secondary = genome.getSecondary(); - float speed = genome.getSpeed() * getProductionModifier(null, 1f) * beemodifier.getProductionModifier(null, 1.f); + float speed = genome.getSpeed() + * getProductionModifier(null, 1f) + * beemodifier.getProductionModifier(null, 1.f); HashMap<GT_Utility.ItemId, Float> drops = new HashMap<>(); HashMap<GT_Utility.ItemId, ItemStack> dropstacks = new HashMap<>(); - for(Map.Entry<ItemStack, Float> entry : primary.getProductChances().entrySet()) { + for (Map.Entry<ItemStack, Float> entry : + primary.getProductChances().entrySet()) { GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(entry.getKey()); - drops.merge(id, Math.min(1f, entry.getValue() * speed) * (float) entry.getKey().stackSize * cycles, Float::sum); + drops.merge( + id, + Math.min(1f, entry.getValue() * speed) * (float) entry.getKey().stackSize * cycles, + Float::sum); dropstacks.computeIfAbsent(id, k -> entry.getKey()); } - for(Map.Entry<ItemStack, Float> entry : secondary.getProductChances().entrySet()) { + for (Map.Entry<ItemStack, Float> entry : + secondary.getProductChances().entrySet()) { GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(entry.getKey()); - drops.merge(id, Math.min(1f, (float) Math.round(entry.getValue() / 2.0F) * speed) * (float) entry.getKey().stackSize * cycles, Float::sum); + drops.merge( + id, + Math.min(1f, (float) Math.round(entry.getValue() / 2.0F) * speed) + * (float) entry.getKey().stackSize + * cycles, + Float::sum); dropstacks.computeIfAbsent(id, k -> entry.getKey()); } - if(primary.isJubilant(genome, this) && secondary.isJubilant(genome, this)) - for(Map.Entry<ItemStack, Float> entry : primary.getSpecialtyChances().entrySet()) { + if (primary.isJubilant(genome, this) && secondary.isJubilant(genome, this)) + for (Map.Entry<ItemStack, Float> entry : + primary.getSpecialtyChances().entrySet()) { GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(entry.getKey()); - drops.merge(id, Math.min(1f, entry.getValue() * speed) * (float) entry.getKey().stackSize * cycles, Float::sum); + drops.merge( + id, + Math.min(1f, entry.getValue() * speed) * (float) entry.getKey().stackSize * cycles, + Float::sum); dropstacks.computeIfAbsent(id, k -> entry.getKey()); } @@ -216,28 +275,27 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM IApiaristTracker breedingTracker = beeRoot.getBreedingTracker(getWorld(), getOwner()); - if(!bee.canSpawn()) { + if (!bee.canSpawn()) { ItemStack convert = new ItemStack(PluginApiculture.items.beePrincessGE); NBTTagCompound nbttagcompound = new NBTTagCompound(); queen.writeToNBT(nbttagcompound); convert.setTagCompound(nbttagcompound); this.mOutputItems[i++] = convert; - } - else { + } else { IBee b = bee.spawnPrincess(this); - if(b != null){ + if (b != null) { ItemStack princess = beeRoot.getMemberStack(b, EnumBeeType.PRINCESS.ordinal()); breedingTracker.registerPrincess(b); this.mOutputItems[i++] = princess; } IBee[] d = bee.spawnDrones(this); - if(d != null && d.length > 0) { + if (d != null && d.length > 0) { HashMap<GT_Utility.ItemId, ItemStack> drones = new HashMap<>(d.length); - for(IBee dr : d) { + for (IBee dr : d) { ItemStack drone = beeRoot.getMemberStack(dr, EnumBeeType.DRONE.ordinal()); breedingTracker.registerDrone(dr); GT_Utility.ItemId drid = GT_Utility.ItemId.createNoCopy(drone); - if(drones.containsKey(drid)) drones.get(drid).stackSize += drone.stackSize; + if (drones.containsKey(drid)) drones.get(drid).stackSize += drone.stackSize; else { this.mOutputItems[i++] = drone; drones.put(drid, drone); @@ -250,50 +308,45 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM setQueen(null); - for(Map.Entry<GT_Utility.ItemId, Float> entry : drops.entrySet()) - { + for (Map.Entry<GT_Utility.ItemId, Float> entry : drops.entrySet()) { ItemStack s = dropstacks.get(entry.getKey()).copy(); - s.stackSize = entry.getValue().intValue() + (getWorld().rand.nextFloat() < (entry.getValue() - (float) entry.getValue().intValue()) ? 1 : 0); - if(s.stackSize > 0 && i < imax) - while(true) { + s.stackSize = entry.getValue().intValue() + + (getWorld().rand.nextFloat() + < (entry.getValue() + - (float) entry.getValue().intValue()) + ? 1 + : 0); + if (s.stackSize > 0 && i < imax) + while (true) { if (s.stackSize <= s.getMaxStackSize()) { this.mOutputItems[i++] = s; break; - } else - this.mOutputItems[i++] = s.splitStack(s.getMaxStackSize()); - if(i >= imax) - break; + } else this.mOutputItems[i++] = s.splitStack(s.getMaxStackSize()); + if (i >= imax) break; } } - for(ItemStack s : pollen.values()) - if(i < imax) - this.mOutputItems[i++] = s; - else - break; + for (ItemStack s : pollen.values()) + if (i < imax) this.mOutputItems[i++] = s; + else break; // Overclock - - this.mMaxProgresstime = (int)(cycles * 550.f); + this.mMaxProgresstime = (int) (cycles * 550.f); int timemaxdivider = this.mMaxProgresstime / 100; int useddivider = 1 << this.mSpeed; int actualdivider = useddivider; this.mMaxProgresstime /= Math.min(actualdivider, timemaxdivider); actualdivider /= Math.min(actualdivider, timemaxdivider); - for(i--; i >= imin; i--) - this.mOutputItems[i].stackSize *= actualdivider; + for (i--; i >= imin; i--) this.mOutputItems[i].stackSize *= actualdivider; - pollinationDelay = Math.max((int)(this.mMaxProgresstime / cycles), 20); // don't run too often + pollinationDelay = Math.max((int) (this.mMaxProgresstime / cycles), 20); // don't run too often this.mProgresstime = 0; - this.mEUt = (int)((float)baseEUtUsage * this.energyMod * useddivider); - if(useddivider == 2) - this.mEUt += 32; - else if(useddivider > 2) - this.mEUt += (32 * (useddivider << (this.mSpeed - 2))); - } - else { + this.mEUt = (int) ((float) baseEUtUsage * this.energyMod * useddivider); + if (useddivider == 2) this.mEUt += 32; + else if (useddivider > 2) this.mEUt += (32 * (useddivider << (this.mSpeed - 2))); + } else { // Breeding time retrievingPollenInThisOperation = true; // Don't pollinate when breeding @@ -302,11 +355,9 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM this.mProgresstime = 0; int useddivider = Math.min(100, 1 << this.mSpeed); this.mMaxProgresstime /= useddivider; - this.mEUt = (int)((float)baseEUtUsage * this.energyMod * useddivider); - if(useddivider == 2) - this.mEUt += 32; - else if(useddivider > 2) - this.mEUt += (32 * (useddivider << (this.mSpeed - 2))); + this.mEUt = (int) ((float) baseEUtUsage * this.energyMod * useddivider); + if (useddivider == 2) this.mEUt += 32; + else if (useddivider > 2) this.mEUt += (32 * (useddivider << (this.mSpeed - 2))); IBee princess = beeRoot.getMember(getQueen()); usedQueenBee = princess; @@ -320,12 +371,9 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM setQueen(null); getDrone().stackSize -= 1; - if(getDrone().stackSize == 0) - setDrone(null); - + if (getDrone().stackSize == 0) setDrone(null); } - return FOUND_AND_SUCCESSFULLY_USED_RECIPE; } @@ -345,15 +393,15 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isClientSide()) { - if(GT_Client.changeDetected == 4) { + if (GT_Client.changeDetected == 4) { /* Client tick counter that is set to 5 on hiding pipes and covers. * It triggers a texture update next client tick when reaching 4, with provision for 3 more update tasks, * spreading client change detection related work and network traffic on different ticks, until it reaches 0. */ aBaseMetaTileEntity.issueTextureUpdate(); } - if(aBaseMetaTileEntity.isActive()){ - if(usedQueen != null) { + if (aBaseMetaTileEntity.isActive()) { + if (usedQueen != null) { if (aTick % 2 == 0) { // FX on client, effect on server IBee bee = beeRoot.getMember(usedQueen); @@ -362,98 +410,84 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM } } } - if(aBaseMetaTileEntity.isServerSide()){ + if (aBaseMetaTileEntity.isServerSide()) { mCharge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity.getEUCapacity() / 3; mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3; doDisplayThings(); - if(!aBaseMetaTileEntity.isActive()) - { - if(aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe()) - { + if (!aBaseMetaTileEntity.isActive()) { + if (aBaseMetaTileEntity.isAllowedToWork() + && (aBaseMetaTileEntity.hasInventoryBeenModified() + || aTick % 600 == 0 + || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) + && hasEnoughEnergyToCheckRecipe()) { int check = checkRecipe(); - if(check == FOUND_AND_SUCCESSFULLY_USED_RECIPE) { + if (check == FOUND_AND_SUCCESSFULLY_USED_RECIPE) { aBaseMetaTileEntity.setActive(true); } } - } - else{ + } else { - if(this.mProgresstime < 0) - { + if (this.mProgresstime < 0) { this.mProgresstime++; return; } - if(this.mStuttering) - { - if(!aBaseMetaTileEntity.isAllowedToWork()) - return; - if(aTick % 100 == 0) - this.mStuttering = false; + if (this.mStuttering) { + if (!aBaseMetaTileEntity.isAllowedToWork()) return; + if (aTick % 100 == 0) this.mStuttering = false; return; } - if(this.hasErrors()) - { - if(!aBaseMetaTileEntity.isAllowedToWork()) - return; - if(aTick % 100 == 0) - if(!canWork(usedQueen)) - this.stutterProcess(); + if (this.hasErrors()) { + if (!aBaseMetaTileEntity.isAllowedToWork()) return; + if (aTick % 100 == 0) if (!canWork(usedQueen)) this.stutterProcess(); return; } - if(!drainEnergyForProcess(this.mEUt)) - { + if (!drainEnergyForProcess(this.mEUt)) { this.mStuttering = true; this.stutterProcess(); return; } this.mProgresstime++; - if(usedQueen != null) { - if(usedQueenBee == null) - usedQueenBee = beeRoot.getMember(usedQueen); + if (usedQueen != null) { + if (usedQueenBee == null) usedQueenBee = beeRoot.getMember(usedQueen); effectData = usedQueenBee.doEffect(effectData, this); - if(!retrievingPollenInThisOperation && floweringMod > 0f && this.mProgresstime % pollinationDelay == 0) - { - if(retrievedpollen == null) - retrievedpollen = usedQueenBee.retrievePollen(this); - if(retrievedpollen != null && (usedQueenBee.pollinateRandom(this, retrievedpollen) || this.mProgresstime % (pollinationDelay * 5) == 0)) - retrievedpollen = null; + if (!retrievingPollenInThisOperation + && floweringMod > 0f + && this.mProgresstime % pollinationDelay == 0) { + if (retrievedpollen == null) retrievedpollen = usedQueenBee.retrievePollen(this); + if (retrievedpollen != null + && (usedQueenBee.pollinateRandom(this, retrievedpollen) + || this.mProgresstime % (pollinationDelay * 5) == 0)) retrievedpollen = null; } } - if(this.mProgresstime % 100 == 0) - { - if(!canWork(usedQueen)) - { + if (this.mProgresstime % 100 == 0) { + if (!canWork(usedQueen)) { this.stutterProcess(); return; } } - if(this.mProgresstime >= this.mMaxProgresstime) - { + if (this.mProgresstime >= this.mMaxProgresstime) { updateModifiers(); for (int i = 0; i < mOutputItems.length; i++) - if(mOutputItems[i] != null) + if (mOutputItems[i] != null) for (int j = 0; j < mOutputItems.length; j++) { - if(j == 0 && isAutomated) - { - if(beeRoot.isMember(mOutputItems[i], EnumBeeType.QUEEN.ordinal()) || beeRoot.isMember(mOutputItems[i], EnumBeeType.PRINCESS.ordinal())) { - if(aBaseMetaTileEntity.addStackToSlot(queen, mOutputItems[i])) - break; - } - else if(beeRoot.isMember(mOutputItems[i], EnumBeeType.DRONE.ordinal())) - if(aBaseMetaTileEntity.addStackToSlot(drone, mOutputItems[i])) - break; - } - else if(i == 0 && j == 0 && beeRoot.isMember(mOutputItems[0], EnumBeeType.QUEEN.ordinal())) - if(aBaseMetaTileEntity.addStackToSlot(queen, mOutputItems[0])) - break; - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) - break; + if (j == 0 && isAutomated) { + if (beeRoot.isMember(mOutputItems[i], EnumBeeType.QUEEN.ordinal()) + || beeRoot.isMember(mOutputItems[i], EnumBeeType.PRINCESS.ordinal())) { + if (aBaseMetaTileEntity.addStackToSlot(queen, mOutputItems[i])) break; + } else if (beeRoot.isMember(mOutputItems[i], EnumBeeType.DRONE.ordinal())) + if (aBaseMetaTileEntity.addStackToSlot(drone, mOutputItems[i])) break; + } else if (i == 0 + && j == 0 + && beeRoot.isMember(mOutputItems[0], EnumBeeType.QUEEN.ordinal())) + if (aBaseMetaTileEntity.addStackToSlot(queen, mOutputItems[0])) break; + if (aBaseMetaTileEntity.addStackToSlot( + getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i])) break; } Arrays.fill(mOutputItems, null); mEUt = 0; @@ -463,25 +497,38 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM aBaseMetaTileEntity.setActive(false); if (doesAutoOutput() && !isOutputEmpty() && aBaseMetaTileEntity.getFrontFacing() != mMainFacing) { - TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); + TileEntity tTileEntity2 = + aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); long tStoredEnergy = aBaseMetaTileEntity.getUniversalEnergyStored(); - int tMaxStacks = (int)(tStoredEnergy/64L); - if (tMaxStacks > mOutputItems.length) - tMaxStacks = mOutputItems.length; - - moveMultipleItemStacks(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,tMaxStacks); + int tMaxStacks = (int) (tStoredEnergy / 64L); + if (tMaxStacks > mOutputItems.length) tMaxStacks = mOutputItems.length; + + moveMultipleItemStacks( + aBaseMetaTileEntity, + tTileEntity2, + aBaseMetaTileEntity.getFrontFacing(), + aBaseMetaTileEntity.getBackFacing(), + null, + false, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1, + tMaxStacks); } - if(aBaseMetaTileEntity.isAllowedToWork() && checkRecipe() == FOUND_AND_SUCCESSFULLY_USED_RECIPE) + if (aBaseMetaTileEntity.isAllowedToWork() && checkRecipe() == FOUND_AND_SUCCESSFULLY_USED_RECIPE) aBaseMetaTileEntity.setActive(true); } } } } - public void cancelProcess(){ - if(this.getBaseMetaTileEntity().isActive() && this.getBaseMetaTileEntity().isServerSide() && usedQueen != null && beeRoot.isMember(usedQueen, EnumBeeType.QUEEN.ordinal())) - { + public void cancelProcess() { + if (this.getBaseMetaTileEntity().isActive() + && this.getBaseMetaTileEntity().isServerSide() + && usedQueen != null + && beeRoot.isMember(usedQueen, EnumBeeType.QUEEN.ordinal())) { Arrays.fill(mOutputItems, null); mEUt = 0; mProgresstime = 0; @@ -495,59 +542,46 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public boolean isItemValidForSlot(int aIndex, ItemStack aStack) { - if(aStack == null) return false; - if(aIndex < getInputSlot()) - return true; - if(aIndex == queen) return beeRoot.isMember(aStack, EnumBeeType.QUEEN.ordinal()) || beeRoot.isMember(aStack, EnumBeeType.PRINCESS.ordinal()); - else if(aIndex == drone) return beeRoot.isMember(aStack, EnumBeeType.DRONE.ordinal()); - else if(aIndex < getOutputSlot()) { - if(!(aStack.getItem() instanceof IApiaryUpgrade) && !GT_ApiaryUpgrade.isUpgrade(aStack)) - return false; - for(int i = drone+1; i < drone+1+4; i++) - { - if(aIndex == i) - continue; + if (aStack == null) return false; + if (aIndex < getInputSlot()) return true; + if (aIndex == queen) + return beeRoot.isMember(aStack, EnumBeeType.QUEEN.ordinal()) + || beeRoot.isMember(aStack, EnumBeeType.PRINCESS.ordinal()); + else if (aIndex == drone) return beeRoot.isMember(aStack, EnumBeeType.DRONE.ordinal()); + else if (aIndex < getOutputSlot()) { + if (!(aStack.getItem() instanceof IApiaryUpgrade) && !GT_ApiaryUpgrade.isUpgrade(aStack)) return false; + for (int i = drone + 1; i < drone + 1 + 4; i++) { + if (aIndex == i) continue; ItemStack s = getStackInSlot(i); - if(s == null) - continue; - if(GT_Utility.areStacksEqual(getStackInSlot(i), aStack)) - return false; - if(GT_ApiaryUpgrade.isUpgrade(aStack)) - { - if(!GT_ApiaryUpgrade.getUpgrade(aStack).isAllowedToWorkWith(getStackInSlot(i))) - return false; - } - else if(GT_ApiaryUpgrade.isUpgrade(s)) - { - if(!GT_ApiaryUpgrade.getUpgrade(s).isAllowedToWorkWith(aStack)) - return false; + if (s == null) continue; + if (GT_Utility.areStacksEqual(getStackInSlot(i), aStack)) return false; + if (GT_ApiaryUpgrade.isUpgrade(aStack)) { + if (!GT_ApiaryUpgrade.getUpgrade(aStack).isAllowedToWorkWith(getStackInSlot(i))) return false; + } else if (GT_ApiaryUpgrade.isUpgrade(s)) { + if (!GT_ApiaryUpgrade.getUpgrade(s).isAllowedToWorkWith(aStack)) return false; } } return true; - } - else return false; - + } else return false; } @Override public void setInventorySlotContents(int aIndex, ItemStack aStack) { - if(aIndex == queen && aStack != null && getBaseMetaTileEntity().isClientSide()) - usedQueen = aStack.copy(); + if (aIndex == queen && aStack != null && getBaseMetaTileEntity().isClientSide()) usedQueen = aStack.copy(); super.setInventorySlotContents(aIndex, aStack); } // Gets called on slot click // - public void onInventoryUpdate(int aIndex){ - if(aIndex > drone && aIndex < getOutputSlot()) - updateModifiers(); + public void onInventoryUpdate(int aIndex) { + if (aIndex > drone && aIndex < getOutputSlot()) updateModifiers(); } @SideOnly(Side.CLIENT) - public ItemStack getUsedQueen(){ + public ItemStack getUsedQueen() { return usedQueen; } - //region IBeeHousing + // region IBeeHousing @Override public Iterable<IBeeModifier> getBeeModifiers() { @@ -576,7 +610,7 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public boolean canBlockSeeTheSky() { - return this.getBaseMetaTileEntity().getSkyAtSide((byte)1); + return this.getBaseMetaTileEntity().getSkyAtSide((byte) 1); } @Override @@ -588,29 +622,31 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public GameProfile getOwner() { - if(owner == null) - owner = new GameProfile(this.getBaseMetaTileEntity().getOwnerUuid(), this.getBaseMetaTileEntity().getOwnerName()); + if (owner == null) + owner = new GameProfile( + this.getBaseMetaTileEntity().getOwnerUuid(), + this.getBaseMetaTileEntity().getOwnerName()); return owner; } @Override public Vec3 getBeeFXCoordinates() { - return Vec3.createVectorHelper(getBaseMetaTileEntity().getXCoord() + 0.5, getBaseMetaTileEntity().getYCoord() + 0.5, getBaseMetaTileEntity().getZCoord() + 0.5); + return Vec3.createVectorHelper( + getBaseMetaTileEntity().getXCoord() + 0.5, + getBaseMetaTileEntity().getYCoord() + 0.5, + getBaseMetaTileEntity().getZCoord() + 0.5); } @Override public BiomeGenBase getBiome() { - if(biomeOverride == null) - return this.getBaseMetaTileEntity().getBiome(); + if (biomeOverride == null) return this.getBaseMetaTileEntity().getBiome(); return biomeOverride; } @Override public EnumTemperature getTemperature() { - if(BiomeHelper.isBiomeHellish(getBiome())) - return EnumTemperature.HELLISH; - return - EnumTemperature.getFromValue(getBiome().temperature + temperatureMod); + if (BiomeHelper.isBiomeHellish(getBiome())) return EnumTemperature.HELLISH; + return EnumTemperature.getFromValue(getBiome().temperature + temperatureMod); } @Override @@ -628,9 +664,9 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM return this.getBaseMetaTileEntity().getCoords(); } - //endregion + // endregion -//region IBeeHousingInventory + // region IBeeHousingInventory @Override public ItemStack getQueen() { return getStackInSlot(queen); @@ -655,18 +691,16 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM public boolean addProduct(ItemStack itemStack, boolean b) { throw new RuntimeException("Should not happen :F"); } -//endregion + // endregion -//region IErrorLogic + // region IErrorLogic public HashSet<IErrorState> mErrorStates = new HashSet<>(); @Override public boolean setCondition(boolean b, IErrorState iErrorState) { - if(b) - mErrorStates.add(iErrorState); - else - mErrorStates.remove(iErrorState); + if (b) mErrorStates.add(iErrorState); + else mErrorStates.remove(iErrorState); return b; } @@ -688,13 +722,12 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM @Override public void writeData(DataOutputStream dataOutputStream) throws IOException { dataOutputStream.write(mErrorStates.size()); - for(IErrorState s : mErrorStates) - dataOutputStream.writeUTF(s.getUniqueName()); + for (IErrorState s : mErrorStates) dataOutputStream.writeUTF(s.getUniqueName()); } @Override public void readData(DataInputStream dataInputStream) throws IOException { - for(int i = dataInputStream.readInt(); i > 0; i--) + for (int i = dataInputStream.readInt(); i > 0; i--) mErrorStates.add(ForestryAPI.errorStateRegistry.getErrorState(dataInputStream.readUTF())); } @@ -708,26 +741,25 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM private Block flowerBlock; private int flowerBlockMeta; - - private boolean checkFlower(IBee bee){ + private boolean checkFlower(IBee bee) { String flowerType = bee.getGenome().getFlowerProvider().getFlowerType(); - if(!this.flowerType.equals(flowerType)) - flowercoords = null; - if(flowercoords != null) { - if( getWorld().getBlock(flowercoords.posX, flowercoords.posY, flowercoords.posZ) != flowerBlock - || getWorld().getBlockMetadata(flowercoords.posX, flowercoords.posY, flowercoords.posZ) != flowerBlockMeta) - if (!FlowerManager.flowerRegistry.isAcceptedFlower(flowerType, getWorld(), flowercoords.posX, flowercoords.posY, flowercoords.posZ)) + if (!this.flowerType.equals(flowerType)) flowercoords = null; + if (flowercoords != null) { + if (getWorld().getBlock(flowercoords.posX, flowercoords.posY, flowercoords.posZ) != flowerBlock + || getWorld().getBlockMetadata(flowercoords.posX, flowercoords.posY, flowercoords.posZ) + != flowerBlockMeta) + if (!FlowerManager.flowerRegistry.isAcceptedFlower( + flowerType, getWorld(), flowercoords.posX, flowercoords.posY, flowercoords.posZ)) flowercoords = null; - else - { + else { flowerBlock = getWorld().getBlock(flowercoords.posX, flowercoords.posY, flowercoords.posZ); - flowerBlockMeta = getWorld().getBlockMetadata(flowercoords.posX, flowercoords.posY, flowercoords.posZ); + flowerBlockMeta = + getWorld().getBlockMetadata(flowercoords.posX, flowercoords.posY, flowercoords.posZ); } } - if(flowercoords == null) { + if (flowercoords == null) { flowercoords = FlowerManager.flowerRegistry.getAcceptedFlowerCoordinates(this, bee, flowerType); - if(flowercoords != null) - { + if (flowercoords != null) { flowerBlock = getWorld().getBlock(flowercoords.posX, flowercoords.posY, flowercoords.posZ); flowerBlockMeta = getWorld().getBlockMetadata(flowercoords.posX, flowercoords.posY, flowercoords.posZ); this.flowerType = flowerType; @@ -736,46 +768,37 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM return flowercoords != null; } - private boolean canWork(ItemStack queen){ + private boolean canWork(ItemStack queen) { clearErrors(); - if(queen == null) - return true; // Reloaded the chunk ? - if(beeRoot.isMember(queen, EnumBeeType.PRINCESS.ordinal())) - return true; + if (queen == null) return true; // Reloaded the chunk ? + if (beeRoot.isMember(queen, EnumBeeType.PRINCESS.ordinal())) return true; IBee bee = beeRoot.getMember(queen); - for(IErrorState err : bee.getCanWork(this)) - setCondition(true, err); + for (IErrorState err : bee.getCanWork(this)) setCondition(true, err); setCondition(!checkFlower(bee), EnumErrorCode.NO_FLOWER); return !hasErrors(); } - private boolean canWork(){ + private boolean canWork() { clearErrors(); EnumBeeType beeType = beeRoot.getType(getQueen()); - if(beeType == EnumBeeType.PRINCESS) - { + if (beeType == EnumBeeType.PRINCESS) { setCondition(!beeRoot.isDrone(getDrone()), EnumErrorCode.NO_DRONE); return !hasErrors(); } - if(beeType == EnumBeeType.QUEEN) - { + if (beeType == EnumBeeType.QUEEN) { IBee bee = beeRoot.getMember(getQueen()); - for(IErrorState err : bee.getCanWork(this)) - setCondition(true, err); + for (IErrorState err : bee.getCanWork(this)) setCondition(true, err); setCondition(!checkFlower(bee), EnumErrorCode.NO_FLOWER); return !hasErrors(); - } - else - { + } else { setCondition(true, EnumErrorCode.NO_QUEEN); return false; } } + // endregion -//endregion - - //region IBeeModifier + // region IBeeModifier private float terrorityMod = 1f; private float mutationMod = 1f; @@ -795,31 +818,24 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM private int maxspeed = 0; - public void updateModifiers(){ + public void updateModifiers() { maxspeed = 0; ApiaryModifiers mods = new ApiaryModifiers(); - for(int i = 2; i < 2+4; i++) - { + for (int i = 2; i < 2 + 4; i++) { ItemStack s = getInputAt(i); - if(s == null) - continue; - if(s.getItem() instanceof IApiaryUpgrade) { + if (s == null) continue; + if (s.getItem() instanceof IApiaryUpgrade) { IApiaryUpgrade up = (IApiaryUpgrade) s.getItem(); up.applyModifiers(mods, s); - } - else if(GT_ApiaryUpgrade.isUpgrade(s)) - { + } else if (GT_ApiaryUpgrade.isUpgrade(s)) { GT_ApiaryUpgrade upgrade = GT_ApiaryUpgrade.getUpgrade(s); - if(upgrade != null) - { + if (upgrade != null) { maxspeed = upgrade.applyMaxSpeedModifier(maxspeed); upgrade.applyModifiers(mods, s); } } } - - terrorityMod = mods.territory; mutationMod = mods.mutation; lifespanMod = mods.lifespan; @@ -836,10 +852,8 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM isAutomated = mods.isAutomated; isRetrievingPollen = mods.isCollectingPollen; - if(mLockedSpeed) - mSpeed = maxspeed; - else - mSpeed = Math.min(mSpeed, maxspeed); + if (mLockedSpeed) mSpeed = maxspeed; + else mSpeed = Math.min(mSpeed, maxspeed); } @Override @@ -891,37 +905,31 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM return sunlightSimulatedMod; } - @Override public boolean isHellish() { return getBiome() == BiomeGenBase.hell; } - public int getMaxSpeed(){ + public int getMaxSpeed() { return maxspeed; } - //endregion + // endregion - //region IBeeListener + // region IBeeListener @Override - public void wearOutEquipment(int i) { - - } + public void wearOutEquipment(int i) {} @Override - public void onQueenDeath() { - - } + public void onQueenDeath() {} @Override public boolean onPollenRetrieved(IIndividual iIndividual) { return false; } - - //endregion + // endregion static final IBeekeepingLogic dummylogic = new IBeekeepingLogic() { @Override @@ -930,19 +938,13 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM } @Override - public void doWork() { - - } + public void doWork() {} @Override - public void syncToClient() { - - } + public void syncToClient() {} @Override - public void syncToClient(EntityPlayerMP entityPlayerMP) { - - } + public void syncToClient(EntityPlayerMP entityPlayerMP) {} @Override public int getBeeProgressPercent() { @@ -955,20 +957,12 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM } @Override - public void doBeeFX() { - - } + public void doBeeFX() {} @Override - public void readFromNBT(NBTTagCompound nbtTagCompound) { - - } + public void readFromNBT(NBTTagCompound nbtTagCompound) {} @Override - public void writeToNBT(NBTTagCompound nbtTagCompound) { - - } + public void writeToNBT(NBTTagCompound nbtTagCompound) {} }; - - } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java index 5de1537d9e..b68d3bc436 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; @@ -14,12 +17,8 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.power.BasicMachineEUPower; import gregtech.common.power.Power; -import net.minecraftforge.fluids.FluidStack; - import java.util.Arrays; - -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Textures.BlockIcons.*; +import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMachine { public static int sUUAperUUM = 1; @@ -29,47 +28,89 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac protected final long EUt; public GT_MetaTileEntity_Massfabricator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "UUM = Matter * Fabrication Squared", 1, 1, "Massfabricator.png", "", + super( + aID, + aName, + aNameRegional, + aTier, + 1, + "UUM = Matter * Fabrication Squared", + 1, + 1, + "Massfabricator.png", + "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_MASSFAB_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_MASSFAB_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_MASSFAB_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_MASSFAB), - TextureFactory.builder().addIcon(OVERLAY_SIDE_MASSFAB_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_MASSFAB_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_MASSFAB_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_MASSFAB_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_MASSFAB_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_MASSFAB), - TextureFactory.builder().addIcon(OVERLAY_FRONT_MASSFAB_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_MASSFAB_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_MASSFAB_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_MASSFAB_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_MASSFAB_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_MASSFAB), - TextureFactory.builder().addIcon(OVERLAY_TOP_MASSFAB_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_MASSFAB_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_MASSFAB_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_MASSFAB_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_MASSFAB_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_MASSFAB), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_MASSFAB_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_MASSFAB_GLOW) + .glow() + .build())); EUt = V[1] * (long) Math.pow(2, mTier + 2); } - public GT_MetaTileEntity_Massfabricator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Massfabricator( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); EUt = V[1] * (long) Math.pow(2, mTier + 2); } - public GT_MetaTileEntity_Massfabricator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Massfabricator( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); EUt = V[1] * (long) Math.pow(2, mTier + 2); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Massfabricator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + return new GT_MetaTileEntity_Massfabricator( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } @Override @@ -85,7 +126,8 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac @Override public void onConfigLoad(GT_Config aConfig) { super.onConfigLoad(aConfig); - sDurationMultiplier = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier); + sDurationMultiplier = aConfig.get( + ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier); sUUAperUUM = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_per_UUM", sUUAperUUM); sUUASpeedBonus = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Speed_Bonus", sUUASpeedBonus); sRequiresUUA = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Requirement", sRequiresUUA); @@ -107,15 +149,21 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac FluidStack tFluid = getDrainableStack(); if ((tFluid == null) || (tFluid.amount < getCapacity())) { this.mOutputFluid = Materials.UUMatter.getFluid(1L); - calculateOverclockedNess((int) EUt, containsUUA(getFillableStack()) ? sDurationMultiplier / sUUASpeedBonus : sDurationMultiplier); - //In case recipe is too OP for that machine + calculateOverclockedNess( + (int) EUt, + containsUUA(getFillableStack()) ? sDurationMultiplier / sUUASpeedBonus : sDurationMultiplier); + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; if (containsUUA(tFluid = getFillableStack())) { tFluid.amount -= sUUAperUUM; return FOUND_AND_SUCCESSFULLY_USED_RECIPE; } - return sRequiresUUA || Arrays.stream(getAllInputs()).anyMatch(s -> ItemList.Circuit_Integrated.isStackEqual(s, true, true)) ? FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS : FOUND_AND_SUCCESSFULLY_USED_RECIPE; + return sRequiresUUA + || Arrays.stream(getAllInputs()) + .anyMatch(s -> ItemList.Circuit_Integrated.isStackEqual(s, true, true)) + ? FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS + : FOUND_AND_SUCCESSFULLY_USED_RECIPE; } return DID_NOT_FIND_RECIPE; } @@ -136,9 +184,7 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac } private boolean containsUUA(FluidStack aFluid) { - return aFluid != null - && aFluid.amount >= sUUAperUUM - && aFluid.isFluidEqual(Materials.UUAmplifier.getFluid(1L)); + return aFluid != null && aFluid.amount >= sUUAperUUM && aFluid.isFluidEqual(Materials.UUAmplifier.getFluid(1L)); } protected class MassfabricatorPower extends BasicMachineEUPower { @@ -151,18 +197,18 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac originalVoltage = computeVoltageForEuRate(euPerTick); if (mTier == 0) { - //Long time calculation + // Long time calculation long xMaxProgresstime = ((long) duration) << 1; if (xMaxProgresstime > Integer.MAX_VALUE - 1) { - //make impossible if too long + // make impossible if too long recipeEuPerTick = Integer.MAX_VALUE - 1; recipeDuration = Integer.MAX_VALUE - 1; } else { - recipeEuPerTick = (int) (V[1] << 2);//2^2=4 so shift <<2 + recipeEuPerTick = (int) (V[1] << 2); // 2^2=4 so shift <<2 recipeDuration = (int) xMaxProgresstime; } } else { - //Long EUt calculation + // Long EUt calculation long xEUt = EUt; long tempEUt = V[1]; @@ -170,20 +216,19 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac recipeDuration = duration; while (tempEUt <= V[mTier - 1]) { - tempEUt <<= 2;//this actually controls overclocking - recipeDuration >>= 1;//this is effect of overclocking + tempEUt <<= 2; // this actually controls overclocking + recipeDuration >>= 1; // this is effect of overclocking if (recipeDuration == 0) - xEUt = (long) (xEUt / 1.1D);//U know, if the time is less than 1 tick make the machine use less power + xEUt = (long) (xEUt + / 1.1D); // U know, if the time is less than 1 tick make the machine use less power } if (xEUt > Integer.MAX_VALUE - 1) { recipeEuPerTick = Integer.MAX_VALUE - 1; recipeDuration = Integer.MAX_VALUE - 1; } else { recipeEuPerTick = (int) xEUt; - if (recipeEuPerTick == 0) - recipeEuPerTick = 1; - if (recipeDuration == 0) - recipeDuration = 1;//set time to 1 tick + if (recipeEuPerTick == 0) recipeEuPerTick = 1; + if (recipeDuration == 0) recipeDuration = 1; // set time to 1 tick } } wasOverclocked = checkIfOverclocked(); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java index 803bc7e163..8616b98fae 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java @@ -1,5 +1,12 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_GLOW; + import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Materials; @@ -23,13 +30,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fluids.FluidStack; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_GLOW; - public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEntity_BasicTank { private static boolean sInterDimensionalTeleportAllowed = true; @@ -49,14 +49,21 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt public TileEntity tTile = null; public GT_MetaTileEntity_MicrowaveEnergyTransmitter(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, new String[]{"Transmits Energy Wirelessly", "Use Nitrogen Plasma", "for Inter-dimensional transmission", "0.004EU Loss per 100 Blocks"}); + super(aID, aName, aNameRegional, aTier, 3, new String[] { + "Transmits Energy Wirelessly", + "Use Nitrogen Plasma", + "for Inter-dimensional transmission", + "0.004EU Loss per 100 Blocks" + }); } - public GT_MetaTileEntity_MicrowaveEnergyTransmitter(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_MicrowaveEnergyTransmitter( + String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); } - public GT_MetaTileEntity_MicrowaveEnergyTransmitter(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_MicrowaveEnergyTransmitter( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); } @@ -80,33 +87,52 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_MicrowaveEnergyTransmitter(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_MicrowaveEnergyTransmitter( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } @Override public String[] getInfoData() { - return new String[]{ - "Coordinates:", - "X: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetX) + EnumChatFormatting.RESET, - "Y: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetY) + EnumChatFormatting.RESET, - "Z: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetZ) + EnumChatFormatting.RESET, - "Dimension: " + EnumChatFormatting.GREEN+this.mTargetD+EnumChatFormatting.RESET, - "Dimension Valid: " + (GT_Utility.isRealDimension(this.mTargetD) ? EnumChatFormatting.GREEN+"Yes"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"No"+EnumChatFormatting.RESET), - "Dimension Registered: " + (DimensionManager.isDimensionRegistered(this.mTargetD) ? EnumChatFormatting.GREEN+"Yes"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"No"+EnumChatFormatting.RESET) + return new String[] { + "Coordinates:", + "X: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetX) + EnumChatFormatting.RESET, + "Y: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetY) + EnumChatFormatting.RESET, + "Z: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetZ) + EnumChatFormatting.RESET, + "Dimension: " + EnumChatFormatting.GREEN + this.mTargetD + EnumChatFormatting.RESET, + "Dimension Valid: " + + (GT_Utility.isRealDimension(this.mTargetD) + ? EnumChatFormatting.GREEN + "Yes" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "No" + EnumChatFormatting.RESET), + "Dimension Registered: " + + (DimensionManager.isDimensionRegistered(this.mTargetD) + ? EnumChatFormatting.GREEN + "Yes" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "No" + EnumChatFormatting.RESET) }; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == 0) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]}; - if (aActive) return new ITexture[]{ + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + if (aSide == 0) return new ITexture[] {MACHINE_CASINGS[mTier][aColorIndex + 1]}; + if (aActive) + return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW).glow().build()}; - return new ITexture[]{ - MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_TELEPORTER), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW) + .glow() + .build() + }; + return new ITexture[] { + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER), + TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build() + }; } @Override @@ -131,7 +157,8 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt @Override public void onConfigLoad(GT_Config aConfig) { - sInterDimensionalTeleportAllowed = aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); + sInterDimensionalTeleportAllowed = + aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); mMaxLoss = Math.max(aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLoss", 50), 11); mMaxLossDistance = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLossDistance", 10000); mPassiveEnergyUse = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.PassiveEnergy", true); @@ -154,7 +181,8 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt for (byte i = -5; i <= 5; i = (byte) (i + 1)) { for (byte j = -5; j <= 5; j = (byte) (j + 1)) { for (byte k = -5; k <= 5; k = (byte) (k + 1)) { - if (getBaseMetaTileEntity().getBlockOffset(i, j, k) == GregTech_API.sBlockMetal5 && getBaseMetaTileEntity().getMetaIDOffset(i, j, k) == 8) {//require osmiridium block + if (getBaseMetaTileEntity().getBlockOffset(i, j, k) == GregTech_API.sBlockMetal5 + && getBaseMetaTileEntity().getMetaIDOffset(i, j, k) == 8) { // require osmiridium block return true; } } @@ -164,20 +192,19 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt } public boolean hasDimensionalTeleportCapability() { - return this.mDebug || - ( - sInterDimensionalTeleportAllowed && - ( - this.hasBlock || - mFluid != null && mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && mFluid.amount >= 1000 - - ) - ) - ; + return this.mDebug + || (sInterDimensionalTeleportAllowed + && (this.hasBlock + || mFluid != null + && mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) + && mFluid.amount >= 1000)); } public boolean isDimensionalTeleportAvailable() { - return this.mDebug || (hasDimensionalTeleportCapability() && GT_Utility.isRealDimension(this.mTargetD) && GT_Utility.isRealDimension(getBaseMetaTileEntity().getWorld().provider.dimensionId)); + return this.mDebug + || (hasDimensionalTeleportCapability() + && GT_Utility.isRealDimension(this.mTargetD) + && GT_Utility.isRealDimension(getBaseMetaTileEntity().getWorld().provider.dimensionId)); } @Override @@ -190,12 +217,15 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt if (getBaseMetaTileEntity().getTimer() % 100L == 50L) { this.hasBlock = checkForBlock(); } - if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone())) { + if ((getBaseMetaTileEntity().isAllowedToWork()) + && (getBaseMetaTileEntity().getRedstone())) { if (getBaseMetaTileEntity().getStoredEU() > (V[mTier] * 16)) { if (mPassiveEnergyUse) { - getBaseMetaTileEntity().decreaseStoredEnergyUnits(2L<<(mTier-1), false); + getBaseMetaTileEntity().decreaseStoredEnergyUnits(2L << (mTier - 1), false); } - if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))) { + if (hasDimensionalTeleportCapability() + && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId + && mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))) { mFluid.amount--; if (mFluid.amount < 1) { mFluid = null; @@ -216,20 +246,21 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt } } int tDistance = distanceCalculation(); - if(tTile!=null) { + if (tTile != null) { if (tTile instanceof IEnergyConnected) { - long packetSize=V[mTier]; - if(tTile instanceof IGregTechTileEntity){ - IMetaTileEntity mte=((IGregTechTileEntity) tTile).getMetaTileEntity(); - if(mte instanceof BaseMetaTileEntity) { - packetSize=((BaseMetaTileEntity) mte).getMaxSafeInput(); + long packetSize = V[mTier]; + if (tTile instanceof IGregTechTileEntity) { + IMetaTileEntity mte = ((IGregTechTileEntity) tTile).getMetaTileEntity(); + if (mte instanceof BaseMetaTileEntity) { + packetSize = ((BaseMetaTileEntity) mte).getMaxSafeInput(); } } long energyUse = 10; if (mMaxLossDistance != 0) { - energyUse = GT_Utility.safeInt(10L + (tDistance * Math.max(mMaxLoss - 10L, 0) / mMaxLossDistance)); + energyUse = GT_Utility.safeInt( + 10L + (tDistance * Math.max(mMaxLoss - 10L, 0) / mMaxLossDistance)); } - energyUse=packetSize + ((V[mTier] * energyUse) / 100); + energyUse = packetSize + ((V[mTier] * energyUse) / 100); if (getBaseMetaTileEntity().isUniversalEnergyStored(energyUse)) { if (((IEnergyConnected) tTile).injectEnergyUnits((byte) 6, packetSize, 1) > 0) { getBaseMetaTileEntity().decreaseStoredEnergyUnits(energyUse, false); @@ -246,7 +277,13 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt } private int distanceCalculation() { - return Math.abs(((this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId) && (isDimensionalTeleportAvailable()) ? 100 : 1) * (int) Math.sqrt(Math.pow(getBaseMetaTileEntity().getXCoord() - this.mTargetX, 2.0D) + Math.pow(getBaseMetaTileEntity().getYCoord() - this.mTargetY, 2.0D) + Math.pow(getBaseMetaTileEntity().getZCoord() - this.mTargetZ, 2.0D))); + return Math.abs(((this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId) + && (isDimensionalTeleportAvailable()) + ? 100 + : 1) + * (int) Math.sqrt(Math.pow(getBaseMetaTileEntity().getXCoord() - this.mTargetX, 2.0D) + + Math.pow(getBaseMetaTileEntity().getYCoord() - this.mTargetY, 2.0D) + + Math.pow(getBaseMetaTileEntity().getZCoord() - this.mTargetZ, 2.0D))); } @Override @@ -378,5 +415,4 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt public ITexture[][][] getTextureSet(ITexture[] aTextures) { return null; } - } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 86ee28b873..67ad6c3a5c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -1,6 +1,7 @@ package gregtech.common.tileentities.machines.basic; -import java.util.ArrayList; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.debugBlockMiner; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -12,8 +13,9 @@ import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; -import gregtech.common.misc.GT_IDrillingLogicDelegateOwner; import gregtech.common.misc.GT_DrillingLogicDelegate; +import gregtech.common.misc.GT_IDrillingLogicDelegateOwner; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -24,14 +26,12 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.ChunkPosition; import net.minecraftforge.common.util.FakePlayer; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.debugBlockMiner; @SuppressWarnings("ObjectEquality") public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine implements GT_IDrillingLogicDelegateOwner { - static final int[] RADIUS = {8, 8, 16, 24, 32}; //Miner radius per tier - static final int[] SPEED = {160, 160, 80, 40, 20}; //Miner cycle time per tier - static final int[] ENERGY = {8, 8, 32, 128, 512}; //Miner energy consumption per tier + static final int[] RADIUS = {8, 8, 16, 24, 32}; // Miner radius per tier + static final int[] SPEED = {160, 160, 80, 40, 20}; // Miner cycle time per tier + static final int[] ENERGY = {8, 8, 32, 128, 512}; // Miner energy consumption per tier /** Miner configured radius */ private int radiusConfig; @@ -40,66 +40,101 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl /** General pipe accessor */ private final GT_DrillingLogicDelegate pipe = new GT_DrillingLogicDelegate(this); + private final int mSpeed; public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, - new String[]{ - "Digging ore instead of you", - "Use Screwdriver to regulate work area", - "Use Soft Mallet to disable and retract the pipe", - String.format("%d EU/t, %d sec per block, no stuttering", ENERGY[aTier], SPEED[aTier] / 20), - String.format("Maximum work area %dx%d", (RADIUS[aTier] * 2 + 1), (RADIUS[aTier] * 2 + 1)), - String.format("Fortune bonus of %d", aTier) - }, - 2, - 2, - "Miner.png", - "", - TextureFactory.of( - TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), - TextureFactory.builder().addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE_GLOW")).glow().build() - ), - TextureFactory.of( - TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), - TextureFactory.builder().addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_GLOW")).glow().build() - ), - TextureFactory.of( - TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), - TextureFactory.builder().addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE_GLOW")).glow().build() - ), - TextureFactory.of( - TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), - TextureFactory.builder().addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_GLOW")).glow().build() - ), - TextureFactory.of( - TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), - TextureFactory.builder().addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE_GLOW")).glow().build() - ), - TextureFactory.of( - TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), - TextureFactory.builder().addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_GLOW")).glow().build() - ), - TextureFactory.of( - TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), - TextureFactory.builder().addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE_GLOW")).glow().build() - ), - TextureFactory.of( - TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM")), - TextureFactory.builder().addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_GLOW")).glow().build() - ) - ); + super( + aID, + aName, + aNameRegional, + aTier, + 1, + new String[] { + "Digging ore instead of you", + "Use Screwdriver to regulate work area", + "Use Soft Mallet to disable and retract the pipe", + String.format("%d EU/t, %d sec per block, no stuttering", ENERGY[aTier], SPEED[aTier] / 20), + String.format("Maximum work area %dx%d", (RADIUS[aTier] * 2 + 1), (RADIUS[aTier] * 2 + 1)), + String.format("Fortune bonus of %d", aTier) + }, + 2, + 2, + "Miner.png", + "", + TextureFactory.of( + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), + TextureFactory.builder() + .addIcon(new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_SIDE_ACTIVE_GLOW")) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), + TextureFactory.builder() + .addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_GLOW")) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), + TextureFactory.builder() + .addIcon(new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_FRONT_ACTIVE_GLOW")) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), + TextureFactory.builder() + .addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_GLOW")) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), + TextureFactory.builder() + .addIcon(new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_TOP_ACTIVE_GLOW")) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), + TextureFactory.builder() + .addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_GLOW")) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of( + new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), + TextureFactory.builder() + .addIcon(new Textures.BlockIcons.CustomIcon( + "basicmachines/miner/OVERLAY_BOTTOM_ACTIVE_GLOW")) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM")), + TextureFactory.builder() + .addIcon(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_GLOW")) + .glow() + .build())); mSpeed = SPEED[aTier]; radiusConfig = RADIUS[mTier]; } - public GT_MetaTileEntity_Miner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Miner( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); mSpeed = SPEED[aTier]; radiusConfig = RADIUS[mTier]; } - public GT_MetaTileEntity_Miner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Miner( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 2, 2, aGUIName, aNEIName); mSpeed = SPEED[aTier]; radiusConfig = RADIUS[mTier]; @@ -117,9 +152,10 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) // - && aStack.getItem() == GT_DrillingLogicDelegate.MINING_PIPE_STACK.getItem(); + && aStack.getItem() == GT_DrillingLogicDelegate.MINING_PIPE_STACK.getItem(); } /** Both output slots must be free to work */ @@ -143,8 +179,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl if (radiusConfig < 0) { radiusConfig = RADIUS[mTier]; } - } - else { + } else { if (radiusConfig <= RADIUS[mTier]) { radiusConfig++; } @@ -154,9 +189,12 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl } GT_Utility.sendChatToPlayer( - aPlayer, - String.format("%s %dx%d", StatCollector.translateToLocal("GT5U.machines.workareaset"), (radiusConfig * 2 + 1), (radiusConfig * 2 + 1)) - ); + aPlayer, + String.format( + "%s %dx%d", + StatCollector.translateToLocal("GT5U.machines.workareaset"), + (radiusConfig * 2 + 1), + (radiusConfig * 2 + 1))); // Rebuild ore cache after change config fillOreList(getBaseMetaTileEntity()); @@ -190,10 +228,11 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl return; } - if (!aBaseMetaTileEntity.isUniversalEnergyStored((long)ENERGY[mTier] * (mSpeed - mProgresstime))) { + if (!aBaseMetaTileEntity.isUniversalEnergyStored((long) ENERGY[mTier] * (mSpeed - mProgresstime))) { mMaxProgresstime = 0; if (debugBlockMiner) { - GT_Log.out.println("MINER: Not enough energy yet, want " + (ENERGY[mTier] * mSpeed) + " have " + aBaseMetaTileEntity.getUniversalEnergyStored()); + GT_Log.out.println("MINER: Not enough energy yet, want " + (ENERGY[mTier] * mSpeed) + " have " + + aBaseMetaTileEntity.getUniversalEnergyStored()); } return; } @@ -215,8 +254,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl if (descends) { fillOreList(aBaseMetaTileEntity); } - } - else { + } else { int x; int y; int z; @@ -224,11 +262,13 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl boolean isOre; do { ChunkPosition oreBlockPos = oreBlockPositions.remove(0); - oreBlock = aBaseMetaTileEntity.getBlockOffset(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + oreBlock = aBaseMetaTileEntity.getBlockOffset( + oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); x = aBaseMetaTileEntity.getXCoord() + oreBlockPos.chunkPosX; y = aBaseMetaTileEntity.getYCoord() + oreBlockPos.chunkPosY; z = aBaseMetaTileEntity.getZCoord() + oreBlockPos.chunkPosZ; - isOre = GT_Utility.isOre(oreBlock, aBaseMetaTileEntity.getWorld().getBlockMetadata(x, y, z)); + isOre = GT_Utility.isOre( + oreBlock, aBaseMetaTileEntity.getWorld().getBlockMetadata(x, y, z)); } // someone else might have removed the block while (!isOre && !oreBlockPositions.isEmpty()); @@ -253,11 +293,10 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl // todo some weird checks. refactorings needed if (block instanceof GT_Block_Ores_Abstract) { TileEntity oreEntity = aBaseMetaTileEntity.getTileEntityOffset(x, pipe.getTipDepth(), z); - if (oreEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores)oreEntity).mNatural) { + if (oreEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) oreEntity).mNatural) { oreBlockPositions.add(new ChunkPosition(x, pipe.getTipDepth(), z)); } - } - else if (GT_Utility.isOre(block, blockMeta)) { + } else if (GT_Utility.isOre(block, blockMeta)) { oreBlockPositions.add(new ChunkPosition(x, pipe.getTipDepth(), z)); } } @@ -286,8 +325,8 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl /** Pushes (or check can push) item to output slots. */ @Override public boolean pushOutputs(ItemStack stack, int count, boolean simulate, boolean allowInputSlots) { - return allowInputSlots && pushOutput(getInputSlot(), getInputSlot() + mInputSlotCount, stack, count, simulate) || - pushOutput(getOutputSlot(), getOutputSlot() + mOutputItems.length, stack, count, simulate); + return allowInputSlots && pushOutput(getInputSlot(), getInputSlot() + mInputSlotCount, stack, count, simulate) + || pushOutput(getOutputSlot(), getOutputSlot() + mOutputItems.length, stack, count, simulate); } private boolean pushOutput(int startIndex, int endIndex, ItemStack stack, int count, boolean simulate) { @@ -300,8 +339,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl mInventory[i] = copy; } return true; - } - else if (GT_Utility.areStacksEqual(slot, stack) && slot.stackSize <= slot.getMaxStackSize() - count) { + } else if (GT_Utility.areStacksEqual(slot, stack) && slot.stackSize <= slot.getMaxStackSize() - count) { if (!simulate) { slot.stackSize += count; } @@ -341,15 +379,19 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine impl @Override public String[] getInfoData() { - return new String[]{ - String.format("%s%s%s", EnumChatFormatting.BLUE, StatCollector.translateToLocal("GT5U.machines.miner"), EnumChatFormatting.RESET), - String.format("%s: %s%d%s %s", - StatCollector.translateToLocal("GT5U.machines.workarea"), - EnumChatFormatting.GREEN, - (radiusConfig * 2 + 1), - EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.machines.blocks") - ) + return new String[] { + String.format( + "%s%s%s", + EnumChatFormatting.BLUE, + StatCollector.translateToLocal("GT5U.machines.miner"), + EnumChatFormatting.RESET), + String.format( + "%s: %s%d%s %s", + StatCollector.translateToLocal("GT5U.machines.workarea"), + EnumChatFormatting.GREEN, + (radiusConfig * 2 + 1), + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.machines.blocks")) }; } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java index 1e1beaf528..e97be4e34a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java @@ -1,66 +1,93 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_GLOW; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_SpawnEventHandler; +import java.util.Arrays; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; -import java.util.Arrays; - -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_GLOW; - public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_TieredMachineBlock { public int mRange = 16; public GT_MetaTileEntity_MonsterRepellent(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Repels nasty Creatures. Range: " + (4 + (12 * aTier)) + " unpowered / " + (16 + (48 * aTier)) + " powered. Costs " + (1L << (aTier * 2))+ " EU/t" ); - } - - public GT_MetaTileEntity_MonsterRepellent(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + super( + aID, + aName, + aNameRegional, + aTier, + 0, + "Repels nasty Creatures. Range: " + (4 + (12 * aTier)) + " unpowered / " + (16 + (48 * aTier)) + + " powered. Costs " + (1L << (aTier * 2)) + " EU/t"); + } + + public GT_MetaTileEntity_MonsterRepellent( + String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_MonsterRepellent(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_MonsterRepellent( + String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_MonsterRepellent(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_MonsterRepellent( + this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]}; - if (aActive) return new ITexture[]{ + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[] {MACHINE_CASINGS[mTier][aColorIndex + 1]}; + if (aActive) + return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW).glow().build()}; - return new ITexture[]{ - MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_TELEPORTER), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW) + .glow() + .build() + }; + return new ITexture[] { + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER), + TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build() + }; } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) { - int[] tCoords = {aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; + int[] tCoords = { + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord(), + aBaseMetaTileEntity.getWorld().provider.dimensionId + }; if ((aTimer % 600 == 0) && !GT_SpawnEventHandler.mobReps.contains(tCoords)) { GT_SpawnEventHandler.mobReps.add(tCoords); } - if (aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1L << (this.mTier * 2), false)) { + if (aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) + && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1L << (this.mTier * 2), false)) { mRange = 16 + (48 * mTier); } else { mRange = 4 + (12 * mTier); @@ -70,13 +97,23 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered @Override public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - int[] tCoords = {aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; + int[] tCoords = { + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord(), + aBaseMetaTileEntity.getWorld().provider.dimensionId + }; GT_SpawnEventHandler.mobReps.add(tCoords); } @Override public void onRemoval() { - int[] tCoords = {this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId}; + int[] tCoords = { + this.getBaseMetaTileEntity().getXCoord(), + this.getBaseMetaTileEntity().getYCoord(), + this.getBaseMetaTileEntity().getZCoord(), + this.getBaseMetaTileEntity().getWorld().provider.dimensionId + }; GT_SpawnEventHandler.mobReps.removeIf(coords -> Arrays.equals(coords, tCoords)); } @@ -141,10 +178,8 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered } @Override - public void saveNBTData(NBTTagCompound aNBT) { - } + public void saveNBTData(NBTTagCompound aNBT) {} @Override - public void loadNBTData(NBTTagCompound aNBT) { - } + public void loadNBTData(NBTTagCompound aNBT) {} } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java index 79b363fac3..2a7e28f10b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; @@ -15,49 +17,88 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_PotionBrewer(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Brewing your Drinks", 1, 0, "PotionBrewer.png", "", + super( + aID, + aName, + aNameRegional, + aTier, + 1, + "Brewing your Drinks", + 1, + 0, + "PotionBrewer.png", + "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_POTIONBREWER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_POTIONBREWER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_POTIONBREWER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_POTIONBREWER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_POTIONBREWER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_POTIONBREWER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_POTIONBREWER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_POTIONBREWER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_POTIONBREWER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_POTIONBREWER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_POTIONBREWER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_POTIONBREWER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_POTIONBREWER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_POTIONBREWER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_POTIONBREWER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_POTIONBREWER), - TextureFactory.builder().addIcon(OVERLAY_TOP_POTIONBREWER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_POTIONBREWER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_POTIONBREWER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_POTIONBREWER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_POTIONBREWER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_POTIONBREWER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_POTIONBREWER_GLOW).glow().build()) - ); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_POTIONBREWER_GLOW) + .glow() + .build())); } - public GT_MetaTileEntity_PotionBrewer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_PotionBrewer( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 0, aGUIName, aNEIName); } - public GT_MetaTileEntity_PotionBrewer(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_PotionBrewer( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 0, aGUIName, aNEIName); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_PotionBrewer(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + return new GT_MetaTileEntity_PotionBrewer( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } @Override @@ -72,8 +113,8 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi return tCheck; } - calculateOverclockedNess(4,128); - //In case recipe is too OP for that machine + calculateOverclockedNess(4, 128); + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; @@ -114,25 +155,30 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi } return setOutput("potion.weakness"); } - if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), getInputAt(0))) { + if (GT_Utility.areStacksEqual( + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), getInputAt(0))) { if (!tModifier.startsWith("strong")) { - return setOutput("potion." + tInputName + ".strong" + (tModifier.isEmpty() ? "" : "." + tModifier)); + return setOutput( + "potion." + tInputName + ".strong" + (tModifier.isEmpty() ? "" : "." + tModifier)); } if (tModifier.startsWith("long")) { return setOutput("potion." + tInputName + tModifier.replaceFirst("long", "")); } return setOutput("potion.thick"); } - if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), getInputAt(0))) { + if (GT_Utility.areStacksEqual( + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), getInputAt(0))) { if (!tModifier.startsWith("long")) { - return setOutput("potion." + tInputName + ".long" + (tModifier.isEmpty() ? "" : "." + tModifier)); + return setOutput( + "potion." + tInputName + ".long" + (tModifier.isEmpty() ? "" : "." + tModifier)); } if (tModifier.startsWith("strong")) { return setOutput("potion." + tInputName + tModifier.replaceFirst("strong", "")); } return setOutput("potion.mundane"); } - if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Gunpowder, 1L), getInputAt(0))) { + if (GT_Utility.areStacksEqual( + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Gunpowder, 1L), getInputAt(0))) { if (!tInputName.endsWith(".splash")) { return setOutput("potion." + tInputName + ".splash"); } @@ -152,15 +198,17 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi if (this.mOutputFluid == null) { this.mOutputFluid = FluidRegistry.getFluidStack("potion.mundane", getFillableStack().amount); } - + getInputAt(0).stackSize -= 1; getFillableStack().amount -= 750; return 2; } @Override - public boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && getRecipeList().containsInput(aStack); + public boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + && getRecipeList().containsInput(aStack); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java index 87105620ea..6771ba0fcc 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java @@ -8,16 +8,26 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import net.minecraft.item.ItemStack; - import java.util.ArrayList; +import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Printer extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_Printer(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "It can copy Books and paint Stuff", 1, 1, "Printer.png", GT_Recipe.GT_Recipe_Map.sPrinterRecipes.mNEIName); + super( + aID, + aName, + aNameRegional, + aTier, + 1, + "It can copy Books and paint Stuff", + 1, + 1, + "Printer.png", + GT_Recipe.GT_Recipe_Map.sPrinterRecipes.mNEIName); } - public GT_MetaTileEntity_Printer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Printer( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 2, 2, aGUIName, aNEIName); } @@ -25,18 +35,20 @@ public class GT_MetaTileEntity_Printer extends GT_MetaTileEntity_BasicMachine { public int checkRecipe() { if (getOutputAt(0) != null) { this.mOutputBlocked += 1; - } else if ((GT_Utility.isStackValid(getInputAt(0))) && (getInputAt(0).stackSize > 0) && - (GT_Utility.isStackInvalid(getSpecialSlot())) && - (OrePrefixes.block.contains(getInputAt(0)))) { - ArrayList<ItemStack> tList = GT_OreDictUnificator.getOres(GT_OreDictUnificator.getAssociation(getInputAt(0))); + } else if ((GT_Utility.isStackValid(getInputAt(0))) + && (getInputAt(0).stackSize > 0) + && (GT_Utility.isStackInvalid(getSpecialSlot())) + && (OrePrefixes.block.contains(getInputAt(0)))) { + ArrayList<ItemStack> tList = + GT_OreDictUnificator.getOres(GT_OreDictUnificator.getAssociation(getInputAt(0))); if (tList.size() > 1) { tList.add(tList.get(0)); int i = 0; for (int j = tList.size() - 1; i < j; i++) { if (GT_Utility.areStacksEqual(getInputAt(0), (ItemStack) tList.get(i))) { this.mOutputItems[0] = GT_Utility.copyAmount(1L, tList.get(i + 1)); - calculateOverclockedNess(1,32); - //In case recipe is too OP for that machine + calculateOverclockedNess(1, 32); + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; getInputAt(0).stackSize -= 1; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java index 2027516dcc..5c06ab5bd1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.debugBlockPump; + import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_BasicTank; import gregtech.api.gui.GT_GUIContainer_BasicTank; @@ -12,6 +15,11 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -27,19 +35,11 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidHandler; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.debugBlockPump; - public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { private static final ItemStack MINING_PIPE = GT_ModHandler.getIC2Item("miningPipe", 0); private static final Block MINING_PIPE_BLOCK = GT_Utility.getBlockFromStack(MINING_PIPE); - private static final Block MINING_PIPE_TIP_BLOCK = GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 0)); + private static final Block MINING_PIPE_TIP_BLOCK = + GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 0)); public static int getMaxDistanceForTier(int aTier) { return (10 * ((int) Math.pow(1.6D, aTier))); @@ -56,18 +56,21 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { public Block mPrimaryPumpedBlock = null; public Block mSecondaryPumpedBlock = null; - private int radiusConfig; //Pump configured radius + private int radiusConfig; // Pump configured radius private boolean mRetractDone = false; public GT_MetaTileEntity_Pump(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, - new String[]{"The best way to empty Oceans! Outputs on top", - getEuUsagePerTier(aTier) + " EU/operation, " + GT_Utility.safeInt(160 / 20 / (long)Math.pow(2, aTier) ) + " sec per bucket, no stuttering", - "Maximum pumping area: " + (getMaxDistanceForTier( aTier) * 2 + 1) + "x" + (getMaxDistanceForTier( aTier) * 2 + 1), - "Use Screwdriver to regulate pumping area", - "Use Soft Mallet to disable and retract the pipe", - "Disable itself upon hitting rocks", - "Disable the bottom pump to retract the pipe!"}); + super(aID, aName, aNameRegional, aTier, 3, new String[] { + "The best way to empty Oceans! Outputs on top", + getEuUsagePerTier(aTier) + " EU/operation, " + GT_Utility.safeInt(160 / 20 / (long) Math.pow(2, aTier)) + + " sec per bucket, no stuttering", + "Maximum pumping area: " + (getMaxDistanceForTier(aTier) * 2 + 1) + "x" + + (getMaxDistanceForTier(aTier) * 2 + 1), + "Use Screwdriver to regulate pumping area", + "Use Soft Mallet to disable and retract the pipe", + "Disable itself upon hitting rocks", + "Disable the bottom pump to retract the pipe!" + }); radiusConfig = getMaxDistanceForTier(mTier); } @@ -90,11 +93,18 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { public void saveNBTData(NBTTagCompound aNBT) { boolean wasPumping = this.wasPumping || !this.mPumpList.isEmpty(); if (debugBlockPump) { - GT_Log.out.println("PUMP: NBT:Save - WasPumping - " + wasPumping + " blocks (" + this.mPrimaryPumpedBlock + ", " + this.mSecondaryPumpedBlock + ")"); + GT_Log.out.println("PUMP: NBT:Save - WasPumping - " + wasPumping + " blocks (" + this.mPrimaryPumpedBlock + + ", " + this.mSecondaryPumpedBlock + ")"); } super.saveNBTData(aNBT); - aNBT.setString("mPumpedBlock1", this.mPrimaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mPrimaryPumpedBlock)); - aNBT.setString("mPumpedBlock2", this.mSecondaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mSecondaryPumpedBlock)); + aNBT.setString( + "mPumpedBlock1", + this.mPrimaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mPrimaryPumpedBlock)); + aNBT.setString( + "mPumpedBlock2", + this.mSecondaryPumpedBlock == null + ? "" + : Block.blockRegistry.getNameForObject(this.mSecondaryPumpedBlock)); aNBT.setBoolean("wasPumping", wasPumping); aNBT.setInteger("radiusConfig", radiusConfig); } @@ -103,13 +113,13 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); this.wasPumping = aNBT.getBoolean("wasPumping"); - if (aNBT.hasKey("radiusConfig")) - this.radiusConfig = aNBT.getInteger("radiusConfig"); + if (aNBT.hasKey("radiusConfig")) this.radiusConfig = aNBT.getInteger("radiusConfig"); this.mPrimaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock1")); this.mSecondaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock2")); if (debugBlockPump) { - GT_Log.out.println("PUMP: NBT:Load - WasPumping - " + this.wasPumping + "(" + aNBT.getString("mPumpedBlock1") + ") " + this.mPrimaryPumpedBlock); + GT_Log.out.println("PUMP: NBT:Load - WasPumping - " + this.wasPumping + "(" + + aNBT.getString("mPumpedBlock1") + ") " + this.mPrimaryPumpedBlock); } } @@ -127,19 +137,19 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { if (radiusConfig >= 0) { radiusConfig--; } - if (radiusConfig < 0) - radiusConfig = max; + if (radiusConfig < 0) radiusConfig = max; } else { if (radiusConfig <= max) { radiusConfig++; } - if (radiusConfig > max) - radiusConfig = 0; + if (radiusConfig > max) radiusConfig = 0; } - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support - - clearQueue(false); + GT_Utility.sendChatToPlayer( + aPlayer, + StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (radiusConfig * 2 + 1) + "x" + + (radiusConfig * 2 + 1)); // TODO Add translation support + clearQueue(false); } @Override @@ -199,10 +209,13 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { this.mPumpCountBelow = 0; IGregTechTileEntity tTileEntity; - for (int i = 1 ; - (i < 21) && ((tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance((byte) 0, i)) != null) - && ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Pump)) ; i++) - { + for (int i = 1; + (i < 21) + && ((tTileEntity = getBaseMetaTileEntity() + .getIGregTechTileEntityAtSideAndDistance((byte) 0, i)) + != null) + && ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Pump)); + i++) { // Apparently someone might stack 21 pumps on top of each other, so let's check for that getBaseMetaTileEntity().setActive(tTileEntity.isActive()); this.mPumpCountBelow += 1; @@ -216,13 +229,18 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { // Only the bottom most pump does anything if (getBaseMetaTileEntity().isAllowedToWork()) { mRetractDone = false; - if ((getBaseMetaTileEntity().isUniversalEnergyStored(this.getEuUsagePerAction())) && ((this.mFluid == null) || (this.mFluid.amount + 1000 <= getCapacity()))) { + if ((getBaseMetaTileEntity().isUniversalEnergyStored(this.getEuUsagePerAction())) + && ((this.mFluid == null) || (this.mFluid.amount + 1000 <= getCapacity()))) { boolean tMovedOneDown = false; - if ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 100L == 0L)) { + if ((this.mPumpList.isEmpty()) + && (getBaseMetaTileEntity().getTimer() % 100L == 0L)) { if (!this.wasPumping) { tMovedOneDown = moveOneDown(); if (!tMovedOneDown) { - if (canMoveDown(getBaseMetaTileEntity().getXCoord(), Math.max(getYOfPumpHead() - 1, 1), getBaseMetaTileEntity().getZCoord())) { + if (canMoveDown( + getBaseMetaTileEntity().getXCoord(), + Math.max(getYOfPumpHead() - 1, 1), + getBaseMetaTileEntity().getZCoord())) { if (debugBlockPump) { GT_Log.out.println("PUMP: No pipe left. Idle for a little longer."); } @@ -240,15 +258,17 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { GT_Log.out.println("PUMP: Was pumping, didn't move down"); } } - int x = getBaseMetaTileEntity().getXCoord(), z = getBaseMetaTileEntity().getZCoord(); + int x = getBaseMetaTileEntity().getXCoord(), + z = getBaseMetaTileEntity().getZCoord(); if (!this.hasValidFluid()) { // We don't have a valid block, let's try to find one int y = getYOfPumpHead(); if (debugBlockPump && this.mPrimaryPumpedBlock != null) { - GT_Log.out.println("PUMP: Had an invalid pump block. Trying to find a fluid at Y: " + y + - " Previous blocks 1: " + this.mPrimaryPumpedBlock + " 2: " + this.mSecondaryPumpedBlock); + GT_Log.out.println("PUMP: Had an invalid pump block. Trying to find a fluid at Y: " + y + + " Previous blocks 1: " + this.mPrimaryPumpedBlock + " 2: " + + this.mSecondaryPumpedBlock); } // First look down checkForFluidToPump(x, y - 1, z); @@ -267,18 +287,20 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } else if (getYOfPumpHead() < getBaseMetaTileEntity().getYCoord()) { // We didn't just look for a block, and the pump head is below the pump - if ((tMovedOneDown) || this.wasPumping || - ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 200L == 100L)) || - (getBaseMetaTileEntity().getTimer() % 72000L == 100L)) - { + if ((tMovedOneDown) + || this.wasPumping + || ((this.mPumpList.isEmpty()) + && (getBaseMetaTileEntity().getTimer() % 200L == 100L)) + || (getBaseMetaTileEntity().getTimer() % 72000L == 100L)) { // Rebuild the list to pump if any of the following conditions are true: // 1) We just moved down // 2) We were previously pumping (and possibly just reloaded) // 3) We have an empty queue and enough time has passed // 4) A long while has has passed if (debugBlockPump) { - GT_Log.out.println("PUMP: Rebuilding pump list - Size " + - this.mPumpList.size() + " WasPumping: " + this.wasPumping + " Timer " + getBaseMetaTileEntity().getTimer()); + GT_Log.out.println("PUMP: Rebuilding pump list - Size " + this.mPumpList.size() + + " WasPumping: " + this.wasPumping + " Timer " + + getBaseMetaTileEntity().getTimer()); } int yPump = getBaseMetaTileEntity().getYCoord() - 1, yHead = getYOfPumpHead(); @@ -287,7 +309,6 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { if (debugBlockPump) { GT_Log.out.println("PUMP: Rebuilt pump list - Size " + this.mPumpList.size()); } - } if ((!tMovedOneDown) && (this.mPumpTimer <= 0)) { while ((!this.mPumpList.isEmpty())) { @@ -301,7 +322,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { this.mPumpTimer = mPumpTimer == 0 ? 1 : mPumpTimer; } } else { - // We somehow have a valid fluid, but the head of the pump isn't below the pump. Perhaps someone broke some pipes + // We somehow have a valid fluid, but the head of the pump isn't below the pump. Perhaps + // someone broke some pipes // -- Clear the queue and we should try to move down until we can find a valid fluid this.clearQueue(false); } @@ -309,7 +331,13 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { GT_Log.out.println("PUMP: Not enough energy? Free space?"); } } else { - if (!mRetractDone && ((aTick % 5) == 0) && ((this.mInventory[0] == null) || this.mInventory[0].stackSize == 0 || (GT_Utility.areStacksEqual(this.mInventory[0], MINING_PIPE) && (this.mInventory[0].stackSize < this.mInventory[0].getMaxStackSize())))) { + if (!mRetractDone + && ((aTick % 5) == 0) + && ((this.mInventory[0] == null) + || this.mInventory[0].stackSize == 0 + || (GT_Utility.areStacksEqual(this.mInventory[0], MINING_PIPE) + && (this.mInventory[0].stackSize + < this.mInventory[0].getMaxStackSize())))) { // try retract if all of these conditions are met // 1. not retracted yet // 2. once per 5 tick @@ -320,7 +348,9 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { final int tZCoord = this.getBaseMetaTileEntity().getZCoord(); this.getBaseMetaTileEntity().getWorld().setBlockToAir(tXCoord, tHeadY, tZCoord); if (tHeadY < this.getBaseMetaTileEntity().getYCoord() - 1) { - getBaseMetaTileEntity().getWorld().setBlock(tXCoord, tHeadY + 1, tZCoord, MINING_PIPE_TIP_BLOCK); + getBaseMetaTileEntity() + .getWorld() + .setBlock(tXCoord, tHeadY + 1, tZCoord, MINING_PIPE_TIP_BLOCK); } if (this.mInventory[0] == null) { final ItemStack copy = MINING_PIPE.copy(); @@ -345,13 +375,12 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { if (this.mFluid != null && (aTick % 20 == 0)) { // auto outputs on top every second or so - IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide((byte)1); //1 is up. + IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide((byte) 1); // 1 is up. if (tTank != null) { FluidStack tDrained = drain(1000, false); if (tDrained != null) { int tFilledAmount = tTank.fill(ForgeDirection.DOWN, tDrained, false); - if (tFilledAmount > 0) - tTank.fill(ForgeDirection.DOWN, drain(tFilledAmount, true), true); + if (tFilledAmount > 0) tTank.fill(ForgeDirection.DOWN, drain(tFilledAmount, true), true); } } } @@ -371,7 +400,9 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } private boolean moveOneDown() { - if ((this.mInventory[0] == null) || (this.mInventory[0].stackSize < 1) || (!GT_Utility.areStacksEqual(this.mInventory[0], MINING_PIPE))) { + if ((this.mInventory[0] == null) + || (this.mInventory[0].stackSize < 1) + || (!GT_Utility.areStacksEqual(this.mInventory[0], MINING_PIPE))) { // No mining pipes if (debugBlockPump) { GT_Log.out.println("PUMP: No mining pipes"); @@ -390,15 +421,19 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { int x = getBaseMetaTileEntity().getXCoord(), z = getBaseMetaTileEntity().getZCoord(); - if ((!consumeFluid(x, yHead - 1, z)) && (!getBaseMetaTileEntity().getBlock(x, yHead - 1, z).isAir(getBaseMetaTileEntity().getWorld(), x, yHead - 1, z))) { + if ((!consumeFluid(x, yHead - 1, z)) + && (!getBaseMetaTileEntity() + .getBlock(x, yHead - 1, z) + .isAir(getBaseMetaTileEntity().getWorld(), x, yHead - 1, z))) { // Either we didn't consume a fluid, or it's a non Air block if (debugBlockPump) { GT_Log.out.println("PUMP: Did not consume fluid, or non-airblock found"); } return false; } - // Try to set the block below us to a a tip - if (!GT_Utility.setBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), x, yHead - 1, z, MINING_PIPE_TIP_BLOCK, 0, false)) { + // Try to set the block below us to a a tip + if (!GT_Utility.setBlockByFakePlayer( + getFakePlayer(getBaseMetaTileEntity()), x, yHead - 1, z, MINING_PIPE_TIP_BLOCK, 0, false)) { if (debugBlockPump) { GT_Log.out.println("PUMP: Could not set block below to new tip"); } @@ -419,14 +454,16 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { // Let's play find the pump head! // TODO: Handle pipe|pipe|head|pipe|pipe - int y = getBaseMetaTileEntity().getYCoord() - 1, x = getBaseMetaTileEntity().getXCoord(), z = getBaseMetaTileEntity().getZCoord(); + int y = getBaseMetaTileEntity().getYCoord() - 1, + x = getBaseMetaTileEntity().getXCoord(), + z = getBaseMetaTileEntity().getZCoord(); - while(y > 0) { + while (y > 0) { Block curBlock = getBaseMetaTileEntity().getBlock(x, y, z); - if(curBlock == MINING_PIPE_BLOCK) { + if (curBlock == MINING_PIPE_BLOCK) { y--; } else if (curBlock == MINING_PIPE_TIP_BLOCK) { - Block nextBlock = getBaseMetaTileEntity().getBlock(x, y - 1 , z); + Block nextBlock = getBaseMetaTileEntity().getBlock(x, y - 1, z); if (nextBlock == MINING_PIPE_BLOCK || nextBlock == MINING_PIPE_TIP_BLOCK) { // We're running into an existing set of pipes -- Turn this block into a pipe and keep going this.clearQueue(true); @@ -443,8 +480,10 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } if (getBaseMetaTileEntity().getBlock(x, y, z) != MINING_PIPE_TIP_BLOCK) { - if (y != getBaseMetaTileEntity().getYCoord() - 1 && getBaseMetaTileEntity().getBlock(x, y + 1, z) == MINING_PIPE_BLOCK) { - // We're below the pump at the bottom of the pipes, we haven't found a tip; make the previous pipe a tip! + if (y != getBaseMetaTileEntity().getYCoord() - 1 + && getBaseMetaTileEntity().getBlock(x, y + 1, z) == MINING_PIPE_BLOCK) { + // We're below the pump at the bottom of the pipes, we haven't found a tip; make the previous pipe a + // tip! this.clearQueue(true); getBaseMetaTileEntity().getWorld().setBlock(x, y + 1, z, MINING_PIPE_TIP_BLOCK); if (debugBlockPump) { @@ -457,7 +496,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } private void clearQueue(boolean checkPumping) { - if(checkPumping) { + if (checkPumping) { this.wasPumping = !this.mPumpList.isEmpty(); } else { this.wasPumping = false; @@ -473,8 +512,9 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { Set<ChunkPosition> checked = new HashSet<>(); this.clearQueue(false); - for (int aY = yStart ; this.mPumpList.isEmpty() && aY >= yEnd ; aY--) { - // Start at the top (presumably the block below the pump), and work our way down to the end (presumably the location of the pump Head) + for (int aY = yStart; this.mPumpList.isEmpty() && aY >= yEnd; aY--) { + // Start at the top (presumably the block below the pump), and work our way down to the end (presumably the + // location of the pump Head) // and build up a queue of fluids to pump fluidsToSearch.add(new ChunkPosition(aX, aY, aZ)); @@ -503,8 +543,10 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } } - private boolean queueFluid(int aX, int aY, int aZ, ArrayDeque<ChunkPosition> fluidsFound, Set<ChunkPosition> checked) { - // If we haven't already looked at this coordinate set, and it's not already in the list of fluids found, see if there is + private boolean queueFluid( + int aX, int aY, int aZ, ArrayDeque<ChunkPosition> fluidsFound, Set<ChunkPosition> checked) { + // If we haven't already looked at this coordinate set, and it's not already in the list of fluids found, see if + // there is // a valid fluid and add it to the fluids found ChunkPosition tCoordinate = new ChunkPosition(aX, aY, aZ); if (checked.add(tCoordinate) && !fluidsFound.contains(tCoordinate)) { @@ -519,8 +561,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { private void checkForFluidToPump(int aX, int aY, int aZ) { // If we don't currently have a valid fluid to pump, try pumping the fluid at the given coordinates - if(this.hasValidFluid()) - return; + if (this.hasValidFluid()) return; Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ); if (aBlock != null) { @@ -550,13 +591,13 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ); - return aBlock != null && - (aBlock == Blocks.water || - aBlock == Blocks.flowing_water || - aBlock == Blocks.lava || - aBlock == Blocks.flowing_lava || - aBlock instanceof IFluidBlock || - aBlock.isAir(getBaseMetaTileEntity().getWorld(), aX, aY, aZ)); + return aBlock != null + && (aBlock == Blocks.water + || aBlock == Blocks.flowing_water + || aBlock == Blocks.lava + || aBlock == Blocks.flowing_lava + || aBlock instanceof IFluidBlock + || aBlock.isAir(getBaseMetaTileEntity().getWorld(), aX, aY, aZ)); } private boolean consumeFluid(int aX, int aY, int aZ) { @@ -567,26 +608,28 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ); if (aBlock != null && ((this.mPrimaryPumpedBlock == aBlock) || (this.mSecondaryPumpedBlock == aBlock))) { - boolean isWaterOrLava = ((this.mPrimaryPumpedBlock == Blocks.water || this.mPrimaryPumpedBlock == Blocks.lava)); + boolean isWaterOrLava = + ((this.mPrimaryPumpedBlock == Blocks.water || this.mPrimaryPumpedBlock == Blocks.lava)); if (isWaterOrLava && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) != 0) { - // Water/Lava that isn't a source block - do nothing here, but set the block to air and consume energy below + // Water/Lava that isn't a source block - do nothing here, but set the block to air and consume energy + // below if (debugBlockPump) { GT_Log.out.println("PUMP: Water/Lava - Not a source block"); } } else if (this.mFluid == null) { // The pump has no internal fluid - if (this.mPrimaryPumpedBlock == Blocks.water) - this.mFluid = GT_ModHandler.getWater(1000L); - else if (this.mPrimaryPumpedBlock == Blocks.lava) - this.mFluid = GT_ModHandler.getLava(1000L); + if (this.mPrimaryPumpedBlock == Blocks.water) this.mFluid = GT_ModHandler.getWater(1000L); + else if (this.mPrimaryPumpedBlock == Blocks.lava) this.mFluid = GT_ModHandler.getLava(1000L); else { // Not water or lava; try to drain and set to air - this.mFluid = ((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, true); + this.mFluid = + ((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, true); } - } else if (GT_ModHandler.isWater(this.mFluid) || GT_ModHandler.isLava(this.mFluid) || - this.mFluid.isFluidEqual(((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, false))) - { + } else if (GT_ModHandler.isWater(this.mFluid) + || GT_ModHandler.isLava(this.mFluid) + || this.mFluid.isFluidEqual( + ((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, false))) { if (!isWaterOrLava) { // Only set Block to Air for non lava/water fluids this.getBaseMetaTileEntity().getWorld().setBlockToAir(aX, aY, aZ); @@ -616,22 +659,27 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } @Override - public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { - aList.addAll(Arrays.asList( EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.pump")+EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (radiusConfig * 2 + 1)+ - EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.blocks"), - "Primary pumping fluid: " + (this.mPrimaryPumpedBlock != null ? this.mPrimaryPumpedBlock.getLocalizedName() : "None"), - "Secondary pumping fluid: " + (this.mSecondaryPumpedBlock != null ? this.mSecondaryPumpedBlock.getLocalizedName() : "None"), - "Pumps below: " + mPumpCountBelow, - "Queue size: " + mPumpList.size(), - "Pump head at Y: " + getYOfPumpHead(), - "Pump timer: " + mPumpTimer, - "Meta Entity Timer: " + getBaseMetaTileEntity().getTimer())); + public ArrayList<String> getSpecialDebugInfo( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { + aList.addAll(Arrays.asList( + EnumChatFormatting.BLUE + + StatCollector.translateToLocal("GT5U.machines.pump") + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.machines.workarea") + ": " + EnumChatFormatting.GREEN + + (radiusConfig * 2 + 1) + EnumChatFormatting.RESET + " " + + StatCollector.translateToLocal("GT5U.machines.blocks"), + "Primary pumping fluid: " + + (this.mPrimaryPumpedBlock != null ? this.mPrimaryPumpedBlock.getLocalizedName() : "None"), + "Secondary pumping fluid: " + + (this.mSecondaryPumpedBlock != null ? this.mSecondaryPumpedBlock.getLocalizedName() : "None"), + "Pumps below: " + mPumpCountBelow, + "Queue size: " + mPumpList.size(), + "Pump head at Y: " + getYOfPumpHead(), + "Pump timer: " + mPumpTimer, + "Meta Entity Timer: " + getBaseMetaTileEntity().getTimer())); return aList; - } - @Override public boolean isSimpleMachine() { return false; @@ -712,7 +760,6 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { return true; } - @Override public int getCapacity() { return 16000 * this.mTier; @@ -724,8 +771,19 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide == 0 || aSide == 1) ? TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_OUT) : TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP)}; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], + (aSide == 0 || aSide == 1) + ? TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_OUT) + : TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP) + }; } @Override @@ -735,10 +793,14 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{ - TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP), TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP), - TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP), TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP),}; + return new ITexture[] { + TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP), + TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP), + TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP), + TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP), + }; } + private FakePlayer mFakePlayer = null; protected FakePlayer getFakePlayer(IGregTechTileEntity aBaseTile) { @@ -750,10 +812,11 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { @Override public String[] getInfoData() { - return new String[]{ - EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.pump")+EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (radiusConfig * 2 + 1)+ - EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.blocks") + return new String[] { + EnumChatFormatting.BLUE + StatCollector.translateToLocal("GT5U.machines.pump") + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.machines.workarea") + ": " + EnumChatFormatting.GREEN + + (radiusConfig * 2 + 1) + EnumChatFormatting.RESET + " " + + StatCollector.translateToLocal("GT5U.machines.blocks") }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java index d6879d31b5..24f49ada10 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.GregTech_API; import gregtech.api.enums.Element; import gregtech.api.enums.ItemList; @@ -14,68 +16,106 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.items.behaviors.Behaviour_DataOrb; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - import java.util.HashMap; import java.util.NoSuchElementException; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; -import static gregtech.api.enums.Textures.BlockIcons.*; - -public class GT_MetaTileEntity_Replicator - extends GT_MetaTileEntity_BasicMachine { +public class GT_MetaTileEntity_Replicator extends GT_MetaTileEntity_BasicMachine { public static final HashMap<Materials, Long> MASS_OVERRIDES = new HashMap<>(); public static final double EXPONENT = GregTech_API.sOPStuff.get("Replicator", "Nerf Exponent", 1.2D); private static int sHeaviestElementMass = 0; static { - //put overrides here - //ex. - //MASS_OVERRIDES.put(Materials.get("cake"),Materials.get("cake").getMass()); - //MASS_OVERRIDES.put(Materials.get("otherCake"),1235234L); - //MASS_OVERRIDES.put(Materials.Kalendrite,1235234L); - //MASS_OVERRIDES.put(Materials.Kalendrite,Materials.Kalendrite.getMass()*2); + // put overrides here + // ex. + // MASS_OVERRIDES.put(Materials.get("cake"),Materials.get("cake").getMass()); + // MASS_OVERRIDES.put(Materials.get("otherCake"),1235234L); + // MASS_OVERRIDES.put(Materials.Kalendrite,1235234L); + // MASS_OVERRIDES.put(Materials.Kalendrite,Materials.Kalendrite.getMass()*2); } public GT_MetaTileEntity_Replicator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Producing Elemental Matter", 1, 1, "Replicator.png", "", + super( + aID, + aName, + aNameRegional, + aTier, + 1, + "Producing Elemental Matter", + 1, + 1, + "Replicator.png", + "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_REPLICATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_REPLICATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_REPLICATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_REPLICATOR), - TextureFactory.builder().addIcon(OVERLAY_SIDE_REPLICATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_REPLICATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_REPLICATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_REPLICATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_REPLICATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_REPLICATOR), - TextureFactory.builder().addIcon(OVERLAY_FRONT_REPLICATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_REPLICATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_REPLICATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_REPLICATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_REPLICATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_REPLICATOR), - TextureFactory.builder().addIcon(OVERLAY_TOP_REPLICATOR_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_REPLICATOR_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_REPLICATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_REPLICATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_REPLICATOR_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_REPLICATOR), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_REPLICATOR_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_REPLICATOR_GLOW) + .glow() + .build())); } - public GT_MetaTileEntity_Replicator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Replicator( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } - public GT_MetaTileEntity_Replicator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Replicator( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Replicator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + return new GT_MetaTileEntity_Replicator( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } public static long cubicFluidMultiplier(long amount) { @@ -87,8 +127,11 @@ public class GT_MetaTileEntity_Replicator FluidStack tFluid = getFillableStack(); if ((tFluid != null) && (tFluid.isFluidEqual(Materials.UUMatter.getFluid(1L)))) { ItemStack tDataOrb = getSpecialSlot(); - if ((ItemList.Tool_DataOrb.isStackEqual(tDataOrb, false, true)) && (Behaviour_DataOrb.getDataTitle(tDataOrb).equals("Elemental-Scan"))) { - Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0); + if ((ItemList.Tool_DataOrb.isStackEqual(tDataOrb, false, true)) + && (Behaviour_DataOrb.getDataTitle(tDataOrb).equals("Elemental-Scan"))) { + Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(tDataOrb)) + .mLinkedMaterials + .get(0); long tMass = cubicFluidMultiplier(MASS_OVERRIDES.getOrDefault(tMaterial, tMaterial.getMass())); if ((tFluid.amount >= tMass) && (tMass > 0L)) { @@ -97,10 +140,11 @@ public class GT_MetaTileEntity_Replicator if (mMaxProgresstime == Integer.MAX_VALUE - 1 || mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - if ((this.mOutputItems[0] = GT_OreDictUnificator.get(OrePrefixes.dust, tMaterial, 1L)) == null) { - if ((this.mOutputItems[0] = GT_OreDictUnificator.get(OrePrefixes.cell, tMaterial, 1L)) != null) { - if ((this.mOutputFluid = GT_Utility.getFluidForFilledItem(this.mOutputItems[0], true)) == null) { + if ((this.mOutputItems[0] = GT_OreDictUnificator.get(OrePrefixes.cell, tMaterial, 1L)) + != null) { + if ((this.mOutputFluid = GT_Utility.getFluidForFilledItem(this.mOutputItems[0], true)) + == null) { if (ItemList.Cell_Empty.isStackEqual(getInputAt(0))) { if (canOutput(this.mOutputItems[0])) { getInputAt(0).stackSize -= 1; @@ -110,7 +154,9 @@ public class GT_MetaTileEntity_Replicator } } else { this.mOutputItems[0] = null; - if ((getDrainableStack() == null) || ((getDrainableStack().isFluidEqual(this.mOutputFluid)) && (getDrainableStack().amount < 16000))) { + if ((getDrainableStack() == null) + || ((getDrainableStack().isFluidEqual(this.mOutputFluid)) + && (getDrainableStack().amount < 16000))) { tFluid.amount = ((int) (tFluid.amount - tMass)); return 2; } @@ -132,8 +178,10 @@ public class GT_MetaTileEntity_Replicator } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && ItemList.Cell_Empty.isStackEqual(aStack); + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + && ItemList.Cell_Empty.isStackEqual(aStack); } @Override @@ -144,8 +192,11 @@ public class GT_MetaTileEntity_Replicator @Override public int getCapacity() { if ((sHeaviestElementMass == 0) && (GregTech_API.sPostloadFinished)) { - sHeaviestElementMass = Materials.getMaterialsMap().values().stream().mapToInt(material -> (int) cubicFluidMultiplier((int) material.getMass())).max().orElseThrow(NoSuchElementException::new); - //Make the Number nicer =) + sHeaviestElementMass = Materials.getMaterialsMap().values().stream() + .mapToInt(material -> (int) cubicFluidMultiplier((int) material.getMass())) + .max() + .orElseThrow(NoSuchElementException::new); + // Make the Number nicer =) sHeaviestElementMass = 1000 * (sHeaviestElementMass / 1000 + 1); } return sHeaviestElementMass; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java index 09e1c6e107..889d8eb11f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; @@ -13,48 +15,88 @@ import gregtech.api.util.GT_Utility; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_RockBreaker extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_RockBreaker(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Put Lava and Water adjacent", 1, 1, "RockBreaker.png", "", + super( + aID, + aName, + aNameRegional, + aTier, + 1, + "Put Lava and Water adjacent", + 1, + 1, + "RockBreaker.png", + "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW) + .glow() + .build())); } - public GT_MetaTileEntity_RockBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_RockBreaker( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } - public GT_MetaTileEntity_RockBreaker(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_RockBreaker( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_RockBreaker(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + return new GT_MetaTileEntity_RockBreaker( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } @Override @@ -63,8 +105,10 @@ public class GT_MetaTileEntity_RockBreaker extends GT_MetaTileEntity_BasicMachin } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && getRecipeList().containsInput(aStack); + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + && getRecipeList().containsInput(aStack); } @Override @@ -75,21 +119,28 @@ public class GT_MetaTileEntity_RockBreaker extends GT_MetaTileEntity_BasicMachin @Override public int checkRecipe() { IGregTechTileEntity aBaseMetaTileEntity = getBaseMetaTileEntity(); - if ((aBaseMetaTileEntity.getBlockOffset(0, 0, 1) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(0, 0, -1) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(-1, 0, 0) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(1, 0, 0) == Blocks.water)) { + if ((aBaseMetaTileEntity.getBlockOffset(0, 0, 1) == Blocks.water) + || (aBaseMetaTileEntity.getBlockOffset(0, 0, -1) == Blocks.water) + || (aBaseMetaTileEntity.getBlockOffset(-1, 0, 0) == Blocks.water) + || (aBaseMetaTileEntity.getBlockOffset(1, 0, 0) == Blocks.water)) { ItemStack tOutput = null; if (aBaseMetaTileEntity.getBlockOffset(0, 1, 0) == Blocks.lava) { tOutput = new ItemStack(Blocks.stone, 1); - } else if ((aBaseMetaTileEntity.getBlockOffset(0, 0, 1) == Blocks.lava) || (aBaseMetaTileEntity.getBlockOffset(0, 0, -1) == Blocks.lava) || (aBaseMetaTileEntity.getBlockOffset(-1, 0, 0) == Blocks.lava) || (aBaseMetaTileEntity.getBlockOffset(1, 0, 0) == Blocks.lava)) { + } else if ((aBaseMetaTileEntity.getBlockOffset(0, 0, 1) == Blocks.lava) + || (aBaseMetaTileEntity.getBlockOffset(0, 0, -1) == Blocks.lava) + || (aBaseMetaTileEntity.getBlockOffset(-1, 0, 0) == Blocks.lava) + || (aBaseMetaTileEntity.getBlockOffset(1, 0, 0) == Blocks.lava)) { tOutput = new ItemStack(Blocks.cobblestone, 1); } if (tOutput != null) { - if(GT_Utility.areStacksEqual(getStackInSlot(getCircuitSlot()), GT_Utility.getIntegratedCircuit(1))){ - if (GT_Utility.areStacksEqual(getInputAt(0), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L))) { + if (GT_Utility.areStacksEqual(getStackInSlot(getCircuitSlot()), GT_Utility.getIntegratedCircuit(1))) { + if (GT_Utility.areStacksEqual( + getInputAt(0), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L))) { tOutput = new ItemStack(Blocks.obsidian, 1); if (canOutput(tOutput)) { getInputAt(0).stackSize -= 1; calculateOverclockedNess(32, 128); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; this.mOutputItems[0] = tOutput; @@ -97,8 +148,8 @@ public class GT_MetaTileEntity_RockBreaker extends GT_MetaTileEntity_BasicMachin } } } else if (canOutput(tOutput)) { - calculateOverclockedNess(32,16); - //In case recipe is too OP for that machine + calculateOverclockedNess(32, 16); + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; this.mOutputItems[0] = tOutput; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java index 4bc9a56e2f..7780e56eee 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java @@ -1,5 +1,9 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.GT_Values.*; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes; + import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IIndividual; import gregtech.GT_Mod; @@ -20,58 +24,95 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.items.behaviors.Behaviour_DataOrb; +import java.util.Objects; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import java.util.Objects; - -import static gregtech.api.enums.GT_Values.*; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes; - public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_Scanner(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Scans Crops and other things.", 1, 1, "Scanner.png", "", - TextureFactory.of( - TextureFactory.of(OVERLAY_SIDE_SCANNER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_SCANNER_ACTIVE_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_SIDE_SCANNER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_SCANNER_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_FRONT_SCANNER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_SCANNER_ACTIVE_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_FRONT_SCANNER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_SCANNER_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_TOP_SCANNER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_SCANNER_ACTIVE_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_TOP_SCANNER), - TextureFactory.builder().addIcon(OVERLAY_TOP_SCANNER_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_BOTTOM_SCANNER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_SCANNER_ACTIVE_GLOW).glow().build()), - TextureFactory.of( - TextureFactory.of(OVERLAY_BOTTOM_SCANNER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_SCANNER_GLOW).glow().build())); + super( + aID, + aName, + aNameRegional, + aTier, + 1, + "Scans Crops and other things.", + 1, + 1, + "Scanner.png", + "", + TextureFactory.of( + TextureFactory.of(OVERLAY_SIDE_SCANNER_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_SCANNER_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_SIDE_SCANNER), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_SCANNER_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_SCANNER_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_SCANNER_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_SCANNER), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_SCANNER_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_TOP_SCANNER_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_SCANNER_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_TOP_SCANNER), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_SCANNER_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_BOTTOM_SCANNER_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_SCANNER_ACTIVE_GLOW) + .glow() + .build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_BOTTOM_SCANNER), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_SCANNER_GLOW) + .glow() + .build())); } - public GT_MetaTileEntity_Scanner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Scanner( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } - public GT_MetaTileEntity_Scanner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_Scanner( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Scanner(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + return new GT_MetaTileEntity_Scanner( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } @Override @@ -92,7 +133,7 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { tIndividual.writeToNBT(tNBT); this.mOutputItems[0].setTagCompound(tNBT); calculateOverclockedNess(2, 500); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; return 2; @@ -117,7 +158,7 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { if (tNBT.getByte("scan") < 4) { tNBT.setByte("scan", (byte) 4); calculateOverclockedNess(8, 160); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } else { @@ -135,13 +176,18 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { aStack.stackSize -= 1; this.mOutputItems[0] = GT_Utility.copyAmount(1L, getSpecialSlot()); calculateOverclockedNess(30, 512); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; return 2; } ItemData tData = GT_OreDictUnificator.getAssociation(aStack); - if ((tData != null) && ((tData.mPrefix == OrePrefixes.dust) || (tData.mPrefix == OrePrefixes.cell)) && (tData.mMaterial.mMaterial.mElement != null) && (!tData.mMaterial.mMaterial.mElement.mIsIsotope) && (tData.mMaterial.mMaterial != Materials.Magic) && (tData.mMaterial.mMaterial.getMass() > 0L)) { + if ((tData != null) + && ((tData.mPrefix == OrePrefixes.dust) || (tData.mPrefix == OrePrefixes.cell)) + && (tData.mMaterial.mMaterial.mElement != null) + && (!tData.mMaterial.mMaterial.mElement.mIsIsotope) + && (tData.mMaterial.mMaterial != Materials.Magic) + && (tData.mMaterial.mMaterial.getMass() > 0L)) { getSpecialSlot().stackSize -= 1; aStack.stackSize -= 1; @@ -149,7 +195,7 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { Behaviour_DataOrb.setDataTitle(this.mOutputItems[0], "Elemental-Scan"); Behaviour_DataOrb.setDataName(this.mOutputItems[0], tData.mMaterial.mMaterial.mElement.name()); calculateOverclockedNess(30, GT_Utility.safeInt(tData.mMaterial.mMaterial.getMass() * 8192L)); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; return 2; @@ -160,7 +206,7 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { aStack.stackSize -= 1; this.mOutputItems[0] = GT_Utility.copyAmount(1L, getSpecialSlot()); calculateOverclockedNess(30, 128); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; return 2; @@ -173,7 +219,7 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { assert this.mOutputItems[0] != null; this.mOutputItems[0].setTagCompound(aStack.getTagCompound()); calculateOverclockedNess(30, 128); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; return 2; @@ -184,38 +230,67 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { this.mOutputItems[0] = GT_Utility.copyAmount(1L, getSpecialSlot()); assert this.mOutputItems[0] != null; - this.mOutputItems[0].setTagCompound(GT_Utility.getNBTContainingShort(new NBTTagCompound(), "map_id", (short) aStack.getItemDamage())); + this.mOutputItems[0].setTagCompound(GT_Utility.getNBTContainingShort( + new NBTTagCompound(), "map_id", (short) aStack.getItemDamage())); calculateOverclockedNess(30, 128); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; return 2; } - if ((aStack.getItem().getUnlocalizedName().contains("Schematic") || aStack.getItem().getUnlocalizedName().contains("schematic")) && !aStack.getItem().getUnlocalizedName().contains("Schematics")) { - if (mTier < 3) - return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + if ((aStack.getItem().getUnlocalizedName().contains("Schematic") + || aStack.getItem().getUnlocalizedName().contains("schematic")) + && !aStack.getItem().getUnlocalizedName().contains("Schematics")) { + if (mTier < 3) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; String sTier = ""; int stackItemID = Item.getIdFromItem(aStack.getItem()); int stackItemDamage = aStack.getItemDamage(); - if (stackItemID == Item.getIdFromItem(Objects.requireNonNull(GT_ModHandler.getModItem(MOD_ID_GC_CORE, "item.schematic", 1L, 0)).getItem())) { - if (stackItemDamage == 0 && aStack.toString().equals(Objects.requireNonNull(GT_ModHandler.getModItem(MOD_ID_GC_CORE, "item.schematic", 1L, 0)).copy().toString())) - sTier = "100"; - else if (stackItemDamage == 1 && aStack.toString().equals(Objects.requireNonNull(GT_ModHandler.getModItem(MOD_ID_GC_CORE, "item.schematic", 1L, 1)).copy().toString())) - sTier = "2"; + if (stackItemID + == Item.getIdFromItem(Objects.requireNonNull( + GT_ModHandler.getModItem(MOD_ID_GC_CORE, "item.schematic", 1L, 0)) + .getItem())) { + if (stackItemDamage == 0 + && aStack.toString() + .equals(Objects.requireNonNull(GT_ModHandler.getModItem( + MOD_ID_GC_CORE, "item.schematic", 1L, 0)) + .copy() + .toString())) sTier = "100"; + else if (stackItemDamage == 1 + && aStack.toString() + .equals(Objects.requireNonNull(GT_ModHandler.getModItem( + MOD_ID_GC_CORE, "item.schematic", 1L, 1)) + .copy() + .toString())) sTier = "2"; } else { - if (stackItemID == Item.getIdFromItem(Objects.requireNonNull(GT_ModHandler.getModItem(MOD_ID_GC_MARS, "item.schematic", 1L, 0)).getItem())) { - if (stackItemDamage == 0 && aStack.toString().equals(Objects.requireNonNull(GT_ModHandler.getModItem(MOD_ID_GC_MARS, "item.schematic", 1L, 0)).copy().toString())) - sTier = "3"; - else if (stackItemDamage == 1 && aStack.toString().equals(Objects.requireNonNull(GT_ModHandler.getModItem(MOD_ID_GC_MARS, "item.schematic", 1L, 1)).copy().toString())) - sTier = "101"; - else if (stackItemDamage == 2 && aStack.toString().equals(Objects.requireNonNull(GT_ModHandler.getModItem(MOD_ID_GC_MARS, "item.schematic", 1L, 2)).copy().toString())) - sTier = "102"; + if (stackItemID + == Item.getIdFromItem(Objects.requireNonNull( + GT_ModHandler.getModItem(MOD_ID_GC_MARS, "item.schematic", 1L, 0)) + .getItem())) { + if (stackItemDamage == 0 + && aStack.toString() + .equals(Objects.requireNonNull(GT_ModHandler.getModItem( + MOD_ID_GC_MARS, "item.schematic", 1L, 0)) + .copy() + .toString())) sTier = "3"; + else if (stackItemDamage == 1 + && aStack.toString() + .equals(Objects.requireNonNull(GT_ModHandler.getModItem( + MOD_ID_GC_MARS, "item.schematic", 1L, 1)) + .copy() + .toString())) sTier = "101"; + else if (stackItemDamage == 2 + && aStack.toString() + .equals(Objects.requireNonNull(GT_ModHandler.getModItem( + MOD_ID_GC_MARS, "item.schematic", 1L, 2)) + .copy() + .toString())) sTier = "102"; } else if (aStack.getUnlocalizedName().matches(".*\\d+.*")) - sTier = aStack.getUnlocalizedName().split("(?<=\\D)(?=\\d)")[1].substring(0, 1); - else - sTier = "1"; + sTier = aStack.getUnlocalizedName() + .split("(?<=\\D)(?=\\d)")[1] + .substring(0, 1); + else sTier = "1"; } getSpecialSlot().stackSize -= 1; @@ -223,15 +298,15 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { this.mOutputItems[0] = GT_Utility.copyAmount(1L, getSpecialSlot()); assert this.mOutputItems[0] != null; - this.mOutputItems[0].setTagCompound(GT_Utility.getNBTContainingShort(new NBTTagCompound(), "rocket_tier", Short.parseShort(sTier))); + this.mOutputItems[0].setTagCompound(GT_Utility.getNBTContainingShort( + new NBTTagCompound(), "rocket_tier", Short.parseShort(sTier))); calculateOverclockedNess(480, 36000); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; return 2; } - } if (getSpecialSlot() == null && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) { if (GT_Utility.ItemNBT.getBookTitle(aStack).equals("Raw Prospection Data")) { @@ -241,11 +316,10 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { this.mOutputItems[0] = GT_Utility.copyAmount(1L, aStack); calculateOverclockedNess(30, 1000); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; return 2; - } } if (ItemList.Tool_DataStick.isStackEqual(getSpecialSlot(), false, true)) { @@ -268,17 +342,15 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { if (GT_AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(this.mOutputItems[0], tRecipe)) { aStack.stackSize -= 1; calculateOverclockedNess(30, tRecipe.mResearchTime); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; getSpecialSlot().stackSize -= 1; return 2; } - } } } - } return 0; } @@ -286,14 +358,16 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (mProgresstime >= (mMaxProgresstime - 1)) { - if ((this.mOutputItems[0] != null) && (this.mOutputItems[0].getUnlocalizedName().equals("gt.metaitem.01.32707"))) { - GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "scanning"); + if ((this.mOutputItems[0] != null) + && (this.mOutputItems[0].getUnlocalizedName().equals("gt.metaitem.01.32707"))) { + GT_Mod.achievements.issueAchievement( + aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + "scanning"); } } super.onPostTick(aBaseMetaTileEntity, aTick); } - @Override public GT_Recipe.GT_Recipe_Map getRecipeList() { return sScannerFakeRecipes; @@ -305,8 +379,10 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && getRecipeList().containsInput(aStack); + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + && getRecipeList().containsInput(aStack); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java index b6ff782cfb..ff54291188 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -15,6 +17,8 @@ import gregtech.common.GT_UndergroundOil; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; import ic2.core.Ic2Items; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -23,115 +27,175 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.List; - -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_BasicMachine { boolean ready = false; public GT_MetaTileEntity_SeismicProspector(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, - "(DEPRECATED, DO NOT USE! SWAP TO ADVANCED VERSION USING SHAPELESS RECIPE!)", 1, 1, - "Default.png", "", + super( + aID, + aName, + aNameRegional, + aTier, + 1, + "(DEPRECATED, DO NOT USE! SWAP TO ADVANCED VERSION USING SHAPELESS RECIPE!)", + 1, + 1, + "Default.png", + "", TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build()), TextureFactory.of( TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW).glow().build())); + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_ROCK_BREAKER_GLOW) + .glow() + .build())); } - public GT_MetaTileEntity_SeismicProspector(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_SeismicProspector( + String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } - public GT_MetaTileEntity_SeismicProspector(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + public GT_MetaTileEntity_SeismicProspector( + String aName, + int aTier, + String[] aDescription, + ITexture[][][] aTextures, + String aGUIName, + String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_SeismicProspector(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); + return new GT_MetaTileEntity_SeismicProspector( + this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isServerSide()) { ItemStack aStack = aPlayer.getCurrentEquippedItem(); - ItemData stackData= GT_OreDictUnificator.getItemData(aStack); - if (!ready && (aStack != null) && ( - (aStack.getItem() == Item.getItemFromBlock(Blocks.tnt) && aStack.stackSize >= 2 ) || - (aStack.getItem() == Ic2Items.industrialTnt.getItem() && aStack.stackSize >= 1 ) || - (aStack.getItem() == Ic2Items.dynamite.getItem() && aStack.stackSize >= 4 ) || - (stackData!=null && stackData.mMaterial.mMaterial == Materials.Glyceryl && aStack.stackSize >= 1 ) || - (aStack.getItem() == ItemList.Block_Powderbarrel.getItem() && aStack.getItemDamage()==ItemList.Block_Powderbarrel.get(1).getItemDamage() && aStack.stackSize >= 8 ) - ) ) { + ItemData stackData = GT_OreDictUnificator.getItemData(aStack); + if (!ready + && (aStack != null) + && ((aStack.getItem() == Item.getItemFromBlock(Blocks.tnt) && aStack.stackSize >= 2) + || (aStack.getItem() == Ic2Items.industrialTnt.getItem() && aStack.stackSize >= 1) + || (aStack.getItem() == Ic2Items.dynamite.getItem() && aStack.stackSize >= 4) + || (stackData != null + && stackData.mMaterial.mMaterial == Materials.Glyceryl + && aStack.stackSize >= 1) + || (aStack.getItem() == ItemList.Block_Powderbarrel.getItem() + && aStack.getItemDamage() + == ItemList.Block_Powderbarrel.get(1) + .getItemDamage() + && aStack.stackSize >= 8))) { if ((!aPlayer.capabilities.isCreativeMode) && (aStack.stackSize != 111)) { - if(aStack.getItem() == Item.getItemFromBlock(Blocks.tnt)){ - aStack.stackSize -= 2; - }else if(aStack.getItem() == Ic2Items.industrialTnt.getItem()){ - aStack.stackSize -= 1; - }else if(aStack.getItem() == Ic2Items.dynamite.getItem()){ - aStack.stackSize -= 4; - }else if(aStack.getItem() == ItemList.Block_Powderbarrel.getItem() && aStack.getItemDamage()==ItemList.Block_Powderbarrel.get(1).getItemDamage()){ - aStack.stackSize -= 8; - }else{ - aStack.stackSize -= 1; + if (aStack.getItem() == Item.getItemFromBlock(Blocks.tnt)) { + aStack.stackSize -= 2; + } else if (aStack.getItem() == Ic2Items.industrialTnt.getItem()) { + aStack.stackSize -= 1; + } else if (aStack.getItem() == Ic2Items.dynamite.getItem()) { + aStack.stackSize -= 4; + } else if (aStack.getItem() == ItemList.Block_Powderbarrel.getItem() + && aStack.getItemDamage() + == ItemList.Block_Powderbarrel.get(1).getItemDamage()) { + aStack.stackSize -= 8; + } else { + aStack.stackSize -= 1; } } this.ready = true; this.mMaxProgresstime = 200; - } else if (ready && mMaxProgresstime == 0 && aStack != null && aStack.stackSize == 1 && aStack.getItem() == ItemList.Tool_DataStick.getItem()) { + } else if (ready + && mMaxProgresstime == 0 + && aStack != null + && aStack.stackSize == 1 + && aStack.getItem() == ItemList.Tool_DataStick.getItem()) { this.ready = false; GT_Utility.ItemNBT.setBookTitle(aPlayer.getCurrentEquippedItem(), "Raw Prospection Data"); List<String> tStringList = new ArrayList<String>(); - //range by tier - int min=-range(); - int max=range(); - int step=step(); + // range by tier + int min = -range(); + int max = range(); + int step = step(); for (int i = this.getBaseMetaTileEntity().getYCoord(); i > 0; i--) { - for (int f = min; f <= max; f+=step) { - for (int g = min; g <= max; g+=step) { + for (int f = min; f <= max; f += step) { + for (int g = min; g <= max; g += step) { Block tBlock = this.getBaseMetaTileEntity().getBlockOffset(f, -i, g); if ((tBlock instanceof GT_Block_Ores_Abstract)) { - TileEntity tTileEntity = getBaseMetaTileEntity().getWorld().getTileEntity(getBaseMetaTileEntity().getXCoord() + f, getBaseMetaTileEntity().getYCoord() + (-i), getBaseMetaTileEntity().getZCoord() + g); + TileEntity tTileEntity = getBaseMetaTileEntity() + .getWorld() + .getTileEntity( + getBaseMetaTileEntity().getXCoord() + f, + getBaseMetaTileEntity().getYCoord() + (-i), + getBaseMetaTileEntity().getZCoord() + g); if ((tTileEntity instanceof GT_TileEntity_Ores)) { - if(((GT_TileEntity_Ores) tTileEntity).mMetaData < 16000){ - Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)]; - if ((tMaterial != null) && (tMaterial != Materials._NULL)) { - if (!tStringList.contains(tMaterial.mDefaultLocalName)) { - tStringList.add(tMaterial.mDefaultLocalName); + if (((GT_TileEntity_Ores) tTileEntity).mMetaData < 16000) { + Materials tMaterial = GregTech_API.sGeneratedMaterials[ + (((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)]; + if ((tMaterial != null) && (tMaterial != Materials._NULL)) { + if (!tStringList.contains(tMaterial.mDefaultLocalName)) { + tStringList.add(tMaterial.mDefaultLocalName); + } } } - } } } else { - int tMetaID = getBaseMetaTileEntity().getWorld().getBlockMetadata(getBaseMetaTileEntity().getXCoord() + f, getBaseMetaTileEntity().getYCoord() + (-i), getBaseMetaTileEntity().getZCoord() + g); - ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { + int tMetaID = getBaseMetaTileEntity() + .getWorld() + .getBlockMetadata( + getBaseMetaTileEntity().getXCoord() + f, + getBaseMetaTileEntity().getYCoord() + (-i), + getBaseMetaTileEntity().getZCoord() + g); + ItemData tAssotiation = + GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); + if ((tAssotiation != null) + && (tAssotiation.mPrefix.toString().startsWith("ore"))) { if (!tStringList.contains(tAssotiation.mMaterial.mMaterial.mDefaultLocalName)) { tStringList.add(tAssotiation.mMaterial.mMaterial.mDefaultLocalName); } @@ -140,7 +204,9 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic } } } - if(tStringList.size()<1){tStringList.add("No Ores found.");} + if (tStringList.size() < 1) { + tStringList.add("No Ores found."); + } FluidStack tFluid = GT_UndergroundOil.undergroundOilReadInformation(getBaseMetaTileEntity()); String[] tStringArray = new String[tStringList.size()]; { @@ -148,7 +214,14 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic tStringArray[i] = tStringList.get(i); } } - GT_Utility.ItemNBT.setProspectionData(aPlayer.getCurrentEquippedItem(), this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId, tFluid, tStringArray); + GT_Utility.ItemNBT.setProspectionData( + aPlayer.getCurrentEquippedItem(), + this.getBaseMetaTileEntity().getXCoord(), + this.getBaseMetaTileEntity().getYCoord(), + this.getBaseMetaTileEntity().getZCoord(), + this.getBaseMetaTileEntity().getWorld().provider.dimensionId, + tFluid, + tStringArray); } } @@ -157,18 +230,24 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic private int range() { switch (mTier) { - case 1: return 16; - case 2: return 32; - case 3: return 48; + case 1: + return 16; + case 2: + return 32; + case 3: + return 48; } return 0; } - private int step(){ - switch (mTier){ - case 1: return 1; - case 2: return 3; - case 3: return 4; + private int step() { + switch (mTier) { + case 1: + return 1; + case 2: + return 3; + case 3: + return 4; } return 1; } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java index eb59f1f7e5..9dc00109cf 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java @@ -1,5 +1,14 @@ package gregtech.common.tileentities.machines.basic; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_SIDES; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_SIDES_GLOW; + import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -10,6 +19,7 @@ import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_Teleporter; import gregtech.common.gui.GT_GUIContainer_Teleporter; +import java.util.List; import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityHanging; @@ -40,17 +50,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fluids.FluidStack; -import java.util.List; - -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_SIDES; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_SIDES_GLOW; - public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { private static boolean sInterDimensionalTeleportAllowed = true; @@ -60,12 +59,16 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { public int mTargetX = 0; public int mTargetY = 0; public int mTargetZ = 0; - public int mTargetD = Integer.MIN_VALUE;//0 + public int mTargetD = Integer.MIN_VALUE; // 0 public boolean mDebug = false; - //public boolean hasEgg = false; + // public boolean hasEgg = false; public GT_MetaTileEntity_Teleporter(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, new String[]{"Teleport long distances with this little device.", "Use a Dragon Egg or Nitrogen Plasma", "for Inter-dimensional transmission"}); + super(aID, aName, aNameRegional, aTier, 3, new String[] { + "Teleport long distances with this little device.", + "Use a Dragon Egg or Nitrogen Plasma", + "for Inter-dimensional transmission" + }); } public GT_MetaTileEntity_Teleporter(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -97,7 +100,9 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { int tCount = 64; for (int i = 0; i < 36; i++) { if (tPlayer.inventory.getStackInSlot(i) != null) { - tCount += (tPlayer.inventory.getStackInSlot(i).getMaxStackSize() > 1 ? tPlayer.inventory.getStackInSlot(i).stackSize : 64); + tCount += (tPlayer.inventory.getStackInSlot(i).getMaxStackSize() > 1 + ? tPlayer.inventory.getStackInSlot(i).stackSize + : 64); } } for (int i = 0; i < 4; i++) { @@ -158,7 +163,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) return true; - //this.hasEgg = checkForEgg(); + // this.hasEgg = checkForEgg(); aBaseMetaTileEntity.openGUI(aPlayer); return true; } @@ -182,35 +187,57 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { public boolean isGivingInformation() { return true; } - @Override public String[] getInfoData() { - return new String[]{ - "Coordinates:", - "X: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetX) + EnumChatFormatting.RESET, - "Y: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetY) + EnumChatFormatting.RESET, - "Z: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetZ) + EnumChatFormatting.RESET, - "Dimension: " + EnumChatFormatting.GREEN+this.mTargetD+EnumChatFormatting.RESET, - "Dimension Valid: " + (GT_Utility.isRealDimension(this.mTargetD) ? EnumChatFormatting.GREEN+"Yes"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"No"+EnumChatFormatting.RESET), - "Dimension Registered: " + (DimensionManager.isDimensionRegistered(this.mTargetD) ? EnumChatFormatting.GREEN+"Yes"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"No"+EnumChatFormatting.RESET) + return new String[] { + "Coordinates:", + "X: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetX) + EnumChatFormatting.RESET, + "Y: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetY) + EnumChatFormatting.RESET, + "Z: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTargetZ) + EnumChatFormatting.RESET, + "Dimension: " + EnumChatFormatting.GREEN + this.mTargetD + EnumChatFormatting.RESET, + "Dimension Valid: " + + (GT_Utility.isRealDimension(this.mTargetD) + ? EnumChatFormatting.GREEN + "Yes" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "No" + EnumChatFormatting.RESET), + "Dimension Registered: " + + (DimensionManager.isDimensionRegistered(this.mTargetD) + ? EnumChatFormatting.GREEN + "Yes" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "No" + EnumChatFormatting.RESET) }; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide != this.getBaseMetaTileEntity().getFrontFacing()) return new ITexture[]{ + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + if (aSide != this.getBaseMetaTileEntity().getFrontFacing()) + return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_TELEPORTER_SIDES), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_SIDES_GLOW).glow().build()}; - if (aActive) return new ITexture[]{ - MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW).glow().build()}; - return new ITexture[]{ + TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_SIDES_GLOW) + .glow() + .build() + }; + if (aActive) + return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_TELEPORTER), - TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build()}; + TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW) + .glow() + .build() + }; + return new ITexture[] { + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER), + TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build() + }; } @Override @@ -235,26 +262,31 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { @Override public void onConfigLoad(GT_Config aConfig) { - sInterDimensionalTeleportAllowed = aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); - sPassiveEnergyDrain = aConfig.get(ConfigCategories.machineconfig, "Teleporter.PassiveDrain", sPassiveEnergyDrain); + sInterDimensionalTeleportAllowed = + aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); + sPassiveEnergyDrain = + aConfig.get(ConfigCategories.machineconfig, "Teleporter.PassiveDrain", sPassiveEnergyDrain); sPowerMultiplyer = aConfig.get(ConfigCategories.machineconfig, "Teleporter.PowerMultipler", sPowerMultiplyer); - sFPowerMultiplyer = sPowerMultiplyer / 100.0; + sFPowerMultiplyer = sPowerMultiplyer / 100.0; } @Override public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { if (getBaseMetaTileEntity().isServerSide()) { - if ((this.mTargetX == 0) && (this.mTargetY == 0) && (this.mTargetZ == 0) && (this.mTargetD == Integer.MIN_VALUE)) { + if ((this.mTargetX == 0) + && (this.mTargetY == 0) + && (this.mTargetZ == 0) + && (this.mTargetD == Integer.MIN_VALUE)) { this.mTargetX = aBaseMetaTileEntity.getXCoord(); this.mTargetY = aBaseMetaTileEntity.getYCoord(); this.mTargetZ = aBaseMetaTileEntity.getZCoord(); this.mTargetD = aBaseMetaTileEntity.getWorld().provider.dimensionId; } - //this.hasEgg = checkForEgg(); + // this.hasEgg = checkForEgg(); } } - - //public boolean checkForEgg() { + + // public boolean checkForEgg() { // for (byte i = -5; i <= 5; i = (byte) (i + 1)) { // for (byte j = -5; j <= 5; j = (byte) (j + 1)) { // for (byte k = -5; k <= 5; k = (byte) (k + 1)) { @@ -265,45 +297,50 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { // } // } // return false; - //} - - + // } public boolean hasDimensionalTeleportCapability() { - return this.mDebug || - //( - sInterDimensionalTeleportAllowed //&& - // ( - // this.hasEgg || - // mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && mFluid.amount >= 1000 - // ) - //) + return this.mDebug + || + // ( + sInterDimensionalTeleportAllowed // && + // ( + // this.hasEgg || + // mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && mFluid.amount >= 1000 + // ) + // ) ; } public boolean isDimensionalTeleportAvailable() { - return this.mDebug || (hasDimensionalTeleportCapability() && GT_Utility.isRealDimension(this.mTargetD) && GT_Utility.isRealDimension(getBaseMetaTileEntity().getWorld().provider.dimensionId)); + return this.mDebug + || (hasDimensionalTeleportCapability() + && GT_Utility.isRealDimension(this.mTargetD) + && GT_Utility.isRealDimension(getBaseMetaTileEntity().getWorld().provider.dimensionId)); } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (mFluid != null) {//Was if null -> Materials.Nitrogen.getPlasma(0); + if (mFluid != null) { // Was if null -> Materials.Nitrogen.getPlasma(0); mFluid = null; } super.onPostTick(aBaseMetaTileEntity, aTick); if (getBaseMetaTileEntity().isServerSide()) { - //if (getBaseMetaTileEntity().getTimer() % 100L == 50L) { + // if (getBaseMetaTileEntity().getTimer() % 100L == 50L) { // this.hasEgg = checkForEgg(); - //} - if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone())) { + // } + if ((getBaseMetaTileEntity().isAllowedToWork()) + && (getBaseMetaTileEntity().getRedstone())) { if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(sPassiveEnergyDrain, false)) { - //if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasEgg || mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))&& new XSTR().nextInt(10)==0) { + // if (hasDimensionalTeleportCapability() && this.mTargetD != + // getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasEgg || + // mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))&& new XSTR().nextInt(10)==0) { // mFluid.amount--; // if (mFluid.amount < 1) { // mFluid = null; // } - //} + // } int tDistance = distanceCalculation(); if (mInventory[0] != null) { TileEntity tTile = null; @@ -317,45 +354,105 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { } if (tTile instanceof IInventory) { int tStacksize = mInventory[0].stackSize; - GT_Utility.moveOneItemStack(this, tTile, (byte) 0, (byte) 0, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + GT_Utility.moveOneItemStack( + this, tTile, (byte) 0, (byte) 0, null, false, (byte) 64, (byte) 1, (byte) 64, + (byte) 1); if (mInventory[0] == null || mInventory[0].stackSize < tStacksize) { - getBaseMetaTileEntity().decreaseStoredEnergyUnits((long) (Math.pow(tDistance, 1.5) * tDistance * (tStacksize - (mInventory[0] == null ? 0 : mInventory[0].stackSize)) * sFPowerMultiplyer), false); + getBaseMetaTileEntity() + .decreaseStoredEnergyUnits( + (long) (Math.pow(tDistance, 1.5) + * tDistance + * (tStacksize + - (mInventory[0] == null ? 0 : mInventory[0].stackSize)) + * sFPowerMultiplyer), + false); } } - } - List entities_in_box = getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB( - Entity.class,AxisAlignedBB.getBoundingBox( - getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(),2) - 1, - getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, - getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, - getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, - getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, - getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) + 2) - ); + List entities_in_box = getBaseMetaTileEntity() + .getWorld() + .getEntitiesWithinAABB( + Entity.class, + AxisAlignedBB.getBoundingBox( + getBaseMetaTileEntity() + .getOffsetX( + getBaseMetaTileEntity() + .getFrontFacing(), + 2) + - 1, + getBaseMetaTileEntity() + .getOffsetY( + getBaseMetaTileEntity() + .getFrontFacing(), + 2) + - 1, + getBaseMetaTileEntity() + .getOffsetZ( + getBaseMetaTileEntity() + .getFrontFacing(), + 2) + - 1, + getBaseMetaTileEntity() + .getOffsetX( + getBaseMetaTileEntity() + .getFrontFacing(), + 2) + + 2, + getBaseMetaTileEntity() + .getOffsetY( + getBaseMetaTileEntity() + .getFrontFacing(), + 2) + + 2, + getBaseMetaTileEntity() + .getOffsetZ( + getBaseMetaTileEntity() + .getFrontFacing(), + 2) + + 2)); for (Object tObject : entities_in_box) { if (((tObject instanceof Entity)) && (!((Entity) tObject).isDead)) { Entity tEntity = (Entity) tObject; -// GT_FML_LOGGER.info("teleport"+(Math.pow(tDistance, 1.5))); - if (getBaseMetaTileEntity().decreaseStoredEnergyUnits((long) (Math.pow(tDistance, 1.5) * weightCalculation(tEntity) * sFPowerMultiplyer), false)) { - //if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasEgg || mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))) { - // mFluid.amount = mFluid.amount - ((int) Math.min(10, (Math.pow(tDistance, 1.5) * weightCalculation(tEntity) / 8192))); + // GT_FML_LOGGER.info("teleport"+(Math.pow(tDistance, 1.5))); + if (getBaseMetaTileEntity() + .decreaseStoredEnergyUnits( + (long) (Math.pow(tDistance, 1.5) + * weightCalculation(tEntity) + * sFPowerMultiplyer), + false)) { + // if (hasDimensionalTeleportCapability() && this.mTargetD != + // getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasEgg || + // mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))) { + // mFluid.amount = mFluid.amount - ((int) Math.min(10, (Math.pow(tDistance, 1.5) * + // weightCalculation(tEntity) / 8192))); // if (mFluid.amount < 1) { // mFluid = null; // } - //} + // } if (tEntity.ridingEntity != null) { tEntity.mountEntity(null); } if (tEntity.riddenByEntity != null) { tEntity.riddenByEntity.mountEntity(null); } - if ((this.mTargetD == getBaseMetaTileEntity().getWorld().provider.dimensionId) || (!isDimensionalTeleportAvailable()) || (!GT_Utility.moveEntityToDimensionAtCoords(tEntity, this.mTargetD, this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D))) { + if ((this.mTargetD == getBaseMetaTileEntity().getWorld().provider.dimensionId) + || (!isDimensionalTeleportAvailable()) + || (!GT_Utility.moveEntityToDimensionAtCoords( + tEntity, + this.mTargetD, + this.mTargetX + 0.5D, + this.mTargetY + 0.5D, + this.mTargetZ + 0.5D))) { if ((tEntity instanceof EntityLivingBase)) { - ((EntityLivingBase) tEntity).setPositionAndUpdate(this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D); + ((EntityLivingBase) tEntity) + .setPositionAndUpdate( + this.mTargetX + 0.5D, + this.mTargetY + 0.5D, + this.mTargetZ + 0.5D); } else { - tEntity.setPosition(this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D); + tEntity.setPosition( + this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D); } } } @@ -370,7 +467,13 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { } private int distanceCalculation() { - return Math.abs(((this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId) && (isDimensionalTeleportAvailable()) ? 4000 : (int) Math.sqrt(Math.pow(getBaseMetaTileEntity().getXCoord() - this.mTargetX, 2.0D) + Math.pow(getBaseMetaTileEntity().getYCoord() - this.mTargetY, 2.0D) + Math.pow(getBaseMetaTileEntity().getZCoord() - this.mTargetZ, 2.0D)))); + return Math.abs( + ((this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId) + && (isDimensionalTeleportAvailable()) + ? 4000 + : (int) Math.sqrt(Math.pow(getBaseMetaTileEntity().getXCoord() - this.mTargetX, 2.0D) + + Math.pow(getBaseMetaTileEntity().getYCoord() - this.mTargetY, 2.0D) + + Math.pow(getBaseMetaTileEntity().getZCoord() - this.mTargetZ, 2.0D)))); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java index a74f8123ec..143548cfaa 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineBase.java @@ -19,9 +19,15 @@ * You should have received a copy of the GNU Lesser General Public License * along with GregTech. If not, see <http://www.gnu.org/licenses/>. */ - package gregtech.common.tileentities.machines.long_distance; +import static mcp.mobius.waila.api.SpecialChars.BLUE; +import static mcp.mobius.waila.api.SpecialChars.GOLD; +import static mcp.mobius.waila.api.SpecialChars.GREEN; +import static mcp.mobius.waila.api.SpecialChars.RED; +import static mcp.mobius.waila.api.SpecialChars.RESET; +import static mcp.mobius.waila.api.SpecialChars.YELLOW; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -30,6 +36,13 @@ import gregtech.api.items.GT_Block_LongDistancePipe; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import net.minecraft.block.Block; @@ -42,32 +55,19 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -import static mcp.mobius.waila.api.SpecialChars.BLUE; -import static mcp.mobius.waila.api.SpecialChars.GOLD; -import static mcp.mobius.waila.api.SpecialChars.GREEN; -import static mcp.mobius.waila.api.SpecialChars.RED; -import static mcp.mobius.waila.api.SpecialChars.RESET; -import static mcp.mobius.waila.api.SpecialChars.YELLOW; - public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_MetaTileEntity_BasicHull_NonElectric { public static int minimalDistancePoints = 64; protected GT_MetaTileEntity_LongDistancePipelineBase mTarget = null, mSender = null; protected ChunkCoordinates mTargetPos = null; protected GT_MetaTileEntity_LongDistancePipelineBase mTooCloseTarget = null, mTooCloseSender = null; - public GT_MetaTileEntity_LongDistancePipelineBase(int aID, String aName, String aNameRegional, int aTier, String aDescription) { + public GT_MetaTileEntity_LongDistancePipelineBase( + int aID, String aName, String aNameRegional, int aTier, String aDescription) { super(aID, aName, aNameRegional, aTier, aDescription); } - public GT_MetaTileEntity_LongDistancePipelineBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_LongDistancePipelineBase( + String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -87,12 +87,8 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta super.loadNBTData(aNBT); if (aNBT.hasKey("target")) { mTargetPos = new ChunkCoordinates( - aNBT.getInteger("target.x"), - aNBT.getInteger("target.y"), - aNBT.getInteger("target.z") - ); - if (getDistanceToSelf(mTargetPos) < minimalDistancePoints) - mTargetPos = null; + aNBT.getInteger("target.x"), aNBT.getInteger("target.y"), aNBT.getInteger("target.z")); + if (getDistanceToSelf(mTargetPos) < minimalDistancePoints) mTargetPos = null; } } @@ -133,23 +129,26 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta // Only check if the target position is loaded TileEntity te = world.getTileEntity(mTargetPos.posX, mTargetPos.posY, mTargetPos.posZ); final IMetaTileEntity tMeta; - if (te instanceof BaseMetaTileEntity && - ((tMeta = ((BaseMetaTileEntity)te).getMetaTileEntity()) instanceof GT_MetaTileEntity_LongDistancePipelineBase) && - isSameClass((GT_MetaTileEntity_LongDistancePipelineBase)tMeta)) - { + if (te instanceof BaseMetaTileEntity + && ((tMeta = ((BaseMetaTileEntity) te).getMetaTileEntity()) + instanceof GT_MetaTileEntity_LongDistancePipelineBase) + && isSameClass((GT_MetaTileEntity_LongDistancePipelineBase) tMeta)) { // It's the right type! - mTarget = (GT_MetaTileEntity_LongDistancePipelineBase)tMeta; - } - else if (te != null) { + mTarget = (GT_MetaTileEntity_LongDistancePipelineBase) tMeta; + } else if (te != null) { // It isn't the right type, kill the target position mTargetPos = null; } } } - if (mTooCloseTarget != null && mTooCloseTarget.mSender == null) mTooCloseTarget.mTooCloseSender = this; - if (mTooCloseSender != null && (mTooCloseSender.isDead() || mTooCloseSender.mTarget != null)) mTooCloseSender = null; + if (mTooCloseTarget != null && mTooCloseTarget.mSender == null) mTooCloseTarget.mTooCloseSender = this; + if (mTooCloseSender != null && (mTooCloseSender.isDead() || mTooCloseSender.mTarget != null)) + mTooCloseSender = null; if (mTarget == null || mTarget == this) return false; - if (mTarget.mSender == null || mTarget.mSender.isDead() || mTarget.mSender.mTarget == null || mTarget.mSender.mTarget.isDead()) { + if (mTarget.mSender == null + || mTarget.mSender.isDead() + || mTarget.mSender.mTarget == null + || mTarget.mSender.mTarget.isDead()) { mTarget.mSender = this; mTarget.mTooCloseSender = null; } @@ -158,19 +157,20 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta } @Override - public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { + public ArrayList<String> getSpecialDebugInfo( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { if (mSender != null && !mSender.isDead() && mSender.mTarget == this) { final ChunkCoordinates coords = mSender.getCoords(); - aList.addAll(Arrays.asList("Is the Target", "Sender is at: X: " + coords.posX + " Y: " + coords.posY + " Z: " + coords.posZ)); + aList.addAll(Arrays.asList( + "Is the Target", "Sender is at: X: " + coords.posX + " Y: " + coords.posY + " Z: " + coords.posZ)); } else { - aList.addAll( - Arrays.asList(checkTarget() ? "Has Target" : "Has no loaded Target", - "Target should be around: X: " + mTargetPos.posX + " Y: " + mTargetPos.posY + " Z: " + mTargetPos.posZ - )); + aList.addAll(Arrays.asList( + checkTarget() ? "Has Target" : "Has no loaded Target", + "Target should be around: X: " + mTargetPos.posX + " Y: " + mTargetPos.posY + " Z: " + + mTargetPos.posZ)); } return aList; - } // What meta should the pipes for this pipeline have @@ -193,44 +193,55 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta // Start scanning from the output side Block aBlock = gtTile.getBlockAtSide(gtTile.getBackFacing()); - if(aBlock instanceof GT_Block_LongDistancePipe) { + if (aBlock instanceof GT_Block_LongDistancePipe) { byte aMetaData = gtTile.getMetaIDAtSide(gtTile.getBackFacing()); if (aMetaData != getPipeMeta()) return; - HashSet<ChunkCoordinates> - tVisited = new HashSet<>(Collections.singletonList(getCoords())), - tWires = new HashSet<>(); - Queue<ChunkCoordinates> - tQueue = new LinkedList<>(Collections.singletonList(getFacingOffset(gtTile, gtTile.getBackFacing()))); + HashSet<ChunkCoordinates> tVisited = new HashSet<>(Collections.singletonList(getCoords())), + tWires = new HashSet<>(); + Queue<ChunkCoordinates> tQueue = + new LinkedList<>(Collections.singletonList(getFacingOffset(gtTile, gtTile.getBackFacing()))); while (!tQueue.isEmpty()) { final ChunkCoordinates aCoords = tQueue.poll(); - if(world.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ) == aBlock && world.getBlockMetadata(aCoords.posX, aCoords.posY, aCoords.posZ) == aMetaData) { + if (world.getBlock(aCoords.posX, aCoords.posY, aCoords.posZ) == aBlock + && world.getBlockMetadata(aCoords.posX, aCoords.posY, aCoords.posZ) == aMetaData) { // We've got another pipe/wire block // TODO: Make sure it's the right type of pipe/wire via meta ChunkCoordinates tCoords; tWires.add(aCoords); - // For each direction, if we haven't already visisted that coordinate, add it to the end of the queue - if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX + 1, aCoords.posY, aCoords.posZ))) tQueue.add(tCoords); - if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX - 1, aCoords.posY, aCoords.posZ))) tQueue.add(tCoords); - if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY + 1, aCoords.posZ))) tQueue.add(tCoords); - if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY - 1, aCoords.posZ))) tQueue.add(tCoords); - if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ + 1))) tQueue.add(tCoords); - if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ - 1))) tQueue.add(tCoords); + // For each direction, if we haven't already visisted that coordinate, add it to the end of the + // queue + if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX + 1, aCoords.posY, aCoords.posZ))) + tQueue.add(tCoords); + if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX - 1, aCoords.posY, aCoords.posZ))) + tQueue.add(tCoords); + if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY + 1, aCoords.posZ))) + tQueue.add(tCoords); + if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY - 1, aCoords.posZ))) + tQueue.add(tCoords); + if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ + 1))) + tQueue.add(tCoords); + if (tVisited.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ - 1))) + tQueue.add(tCoords); } else { // It's not a block - let's see if it's a tile entity TileEntity tTileEntity = world.getTileEntity(aCoords.posX, aCoords.posY, aCoords.posZ); - if ( - tTileEntity != gtTile && tTileEntity instanceof BaseMetaTileEntity && - ((BaseMetaTileEntity)tTileEntity).getMetaTileEntity() instanceof GT_MetaTileEntity_LongDistancePipelineBase) - { - final GT_MetaTileEntity_LongDistancePipelineBase tGtTile = (GT_MetaTileEntity_LongDistancePipelineBase)((BaseMetaTileEntity) tTileEntity).getMetaTileEntity(); - if (isSameClass(tGtTile) && tWires.contains( - tGtTile.getFacingOffset((BaseMetaTileEntity)tTileEntity, ((BaseMetaTileEntity) tTileEntity).getFrontFacing()) - )) { - // If it's the same class, and we've scanned a wire in front of it (the input side), we've found our target + if (tTileEntity != gtTile + && tTileEntity instanceof BaseMetaTileEntity + && ((BaseMetaTileEntity) tTileEntity).getMetaTileEntity() + instanceof GT_MetaTileEntity_LongDistancePipelineBase) { + final GT_MetaTileEntity_LongDistancePipelineBase tGtTile = + (GT_MetaTileEntity_LongDistancePipelineBase) + ((BaseMetaTileEntity) tTileEntity).getMetaTileEntity(); + if (isSameClass(tGtTile) + && tWires.contains(tGtTile.getFacingOffset( + (BaseMetaTileEntity) tTileEntity, + ((BaseMetaTileEntity) tTileEntity).getFrontFacing()))) { + // If it's the same class, and we've scanned a wire in front of it (the input side), we've + // found our target // still need to check if it's distant enough int distance = getDistanceToSelf(aCoords); if (distance > minimalDistancePoints) { @@ -245,27 +256,25 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta } } - // Remove this block from the visited because we might end up back here from another wire that IS connected to the + // Remove this block from the visited because we might end up back here from another wire that + // IS connected to the // input side tVisited.remove(aCoords); } } } } - } protected int getDistanceToSelf(ChunkCoordinates aCoords) { - return Math.abs(getBaseMetaTileEntity().getXCoord() - aCoords.posX) + - Math.abs(getBaseMetaTileEntity().getYCoord() - aCoords.posY) / 2 + - Math.abs(getBaseMetaTileEntity().getZCoord() - aCoords.posZ); + return Math.abs(getBaseMetaTileEntity().getXCoord() - aCoords.posX) + + Math.abs(getBaseMetaTileEntity().getYCoord() - aCoords.posY) / 2 + + Math.abs(getBaseMetaTileEntity().getZCoord() - aCoords.posZ); } public ChunkCoordinates getFacingOffset(IGregTechTileEntity gt_tile, byte aSide) { return new ChunkCoordinates( - gt_tile.getOffsetX(aSide, 1), gt_tile.getOffsetY(aSide, 1), gt_tile.getOffsetZ(aSide, 1) - ); - + gt_tile.getOffsetX(aSide, 1), gt_tile.getOffsetY(aSide, 1), gt_tile.getOffsetZ(aSide, 1)); } public ChunkCoordinates getCoords() { @@ -275,8 +284,9 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta @Override public void onMachineBlockUpdate() { - //GT_Mod.GT_FML_LOGGER.info("You're dead to me"); - mTargetPos = null; mSender = null; + // GT_Mod.GT_FML_LOGGER.info("You're dead to me"); + mTargetPos = null; + mSender = null; } @Override @@ -285,42 +295,37 @@ public abstract class GT_MetaTileEntity_LongDistancePipelineBase extends GT_Meta } @Override - public boolean shouldTriggerBlockUpdate() { return true; } + public boolean shouldTriggerBlockUpdate() { + return true; + } @Override - public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public void getWailaBody( + ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { final NBTTagCompound tag = accessor.getNBTData(); final int facing = getBaseMetaTileEntity().getFrontFacing(); final int side = (byte) accessor.getSide().ordinal(); - if (side == facing) - currentTip.add(GOLD + "Pipeline Input" + RESET); - else if (side == ForgeDirection.OPPOSITES[facing]) - currentTip.add(BLUE + "Pipeline Output" + RESET); - else - currentTip.add("Pipeline Side"); + if (side == facing) currentTip.add(GOLD + "Pipeline Input" + RESET); + else if (side == ForgeDirection.OPPOSITES[facing]) currentTip.add(BLUE + "Pipeline Output" + RESET); + else currentTip.add("Pipeline Side"); - if (tag.getBoolean("hasSender")) - currentTip.add("Other End of Input: " + GREEN + "distance" + RESET); + if (tag.getBoolean("hasSender")) currentTip.add("Other End of Input: " + GREEN + "distance" + RESET); else if (tag.getBoolean("hasTooCloseSender")) currentTip.add("Other End of Input: " + RED + "too close" + RESET); - else - currentTip.add("Other End of Input: " + YELLOW + "cannot found(may need to update other end)" + RESET); + else currentTip.add("Other End of Input: " + YELLOW + "cannot found(may need to update other end)" + RESET); - if (tag.getBoolean("hasTarget")) - currentTip.add("Other End of Output: " + GREEN + "distance" + RESET); + if (tag.getBoolean("hasTarget")) currentTip.add("Other End of Output: " + GREEN + "distance" + RESET); else if (tag.getBoolean("hasTooCloseTarget")) currentTip.add("Other End of Output: " + RED + "too close" + RESET); - else - currentTip.add("Other End of Output: " + YELLOW + "cannot found" + RESET); + else currentTip.add("Other End of Output: " + YELLOW + "cannot found" + RESET); super.getWailaBody(itemStack, currentTip, accessor, config); - } - @Override - public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { + public void getWailaNBTData( + EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, int z) { super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setBoolean("hasSender", mSender != null); diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java index fe0a8527ab..849ce40101 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java @@ -19,9 +19,14 @@ * You should have received a copy of the GNU Lesser General Public License * along with GregTech. If not, see <http://www.gnu.org/licenses/>. */ - package gregtech.common.tileentities.machines.long_distance; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_BACK; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_FRONT; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE_GLOW; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -33,12 +38,6 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_BACK; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_FRONT; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE_GLOW; - public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEntity_LongDistancePipelineBase { static final FluidTankInfo[] emptyTank = {new FluidTankInfo(null, Integer.MAX_VALUE)}; @@ -46,7 +45,8 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti super(aID, aName, aNameRegional, aTier, "Sends fluids over long distances"); } - public GT_MetaTileEntity_LongDistancePipelineFluid(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_LongDistancePipelineFluid( + String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -63,7 +63,7 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti public IFluidHandler getTank() { final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity(); TileEntity tankTile = tTile.getTileEntityAtSide(tTile.getBackFacing()); - if (tankTile instanceof IFluidHandler) return (IFluidHandler)tankTile; + if (tankTile instanceof IFluidHandler) return (IFluidHandler) tankTile; else return null; } @@ -72,24 +72,27 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti if (checkTarget()) { final IFluidHandler tankTile = getTank(); if (tankTile != null) return tankTile.getTankInfo(aSide); - } return emptyTank; } + @Override public int fill(ForgeDirection aSide, FluidStack aFluid, boolean aDoFill) { if (checkTarget()) { final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity(); final IFluidHandler tankTile = getTank(); - if (tankTile != null) return tankTile.fill(ForgeDirection.getOrientation(tTile.getFrontFacing()), aFluid, aDoFill); + if (tankTile != null) + return tankTile.fill(ForgeDirection.getOrientation(tTile.getFrontFacing()), aFluid, aDoFill); } return 0; } + @Override public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean aDoDrain) { return null; } + @Override public FluidStack drain(ForgeDirection aSide, int aMaxDrain, boolean aDoDrain) { return null; @@ -99,25 +102,36 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_LongDistancePipelineFluid(mName, mTier, getDescription()[0], mTextures); } + @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { return new ITexture[0][0][0]; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) - return new ITexture[]{ - MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_PIPELINE_FLUID_FRONT)}; + return new ITexture[] { + MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_FLUID_FRONT) + }; else if (aSide == GT_Utility.getOppositeSide(aFacing)) - return new ITexture[]{ - MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_PIPELINE_FLUID_BACK)}; + return new ITexture[] { + MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_FLUID_BACK) + }; else - return new ITexture[]{ - MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_PIPELINE_FLUID_SIDE), - TextureFactory.builder().addIcon(OVERLAY_PIPELINE_FLUID_SIDE_GLOW).glow().build()}; + return new ITexture[] { + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_PIPELINE_FLUID_SIDE), + TextureFactory.builder() + .addIcon(OVERLAY_PIPELINE_FLUID_SIDE_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java index b6b3636ab0..0559290df6 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java @@ -19,9 +19,14 @@ * You should have received a copy of the GNU Lesser General Public License * along with GregTech. If not, see <http://www.gnu.org/licenses/>. */ - package gregtech.common.tileentities.machines.long_distance; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_BACK; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_FRONT; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE_GLOW; + import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -33,18 +38,13 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_BACK; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_FRONT; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE_GLOW; - public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntity_LongDistancePipelineBase { public GT_MetaTileEntity_LongDistancePipelineItem(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, "Sends Items over long distances"); } - public GT_MetaTileEntity_LongDistancePipelineItem(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_LongDistancePipelineItem( + String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -61,7 +61,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit public IInventory getInventory() { final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity(); TileEntity invTile = tTile.getTileEntityAtSide(tTile.getBackFacing()); - if (invTile instanceof IInventory) return (IInventory)invTile; + if (invTile instanceof IInventory) return (IInventory) invTile; else return null; } @@ -73,6 +73,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit } return null; } + @Override public ItemStack getStackInSlotOnClosing(int aSlot) { if (checkTarget()) { @@ -81,6 +82,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit } return null; } + @Override public ItemStack getStackInSlot(int aSlot) { if (checkTarget()) { @@ -89,6 +91,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit } return null; } + @Override public String getInventoryName() { if (checkTarget()) { @@ -97,6 +100,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit } return super.getInventoryName(); } + @Override public int getSizeInventory() { if (checkTarget()) { @@ -105,6 +109,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit } return 0; } + @Override public int getInventoryStackLimit() { if (checkTarget()) { @@ -113,6 +118,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit } return 0; } + @Override public void setInventorySlotContents(int aSlot, ItemStack aStack) { if (checkTarget()) { @@ -120,6 +126,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit if (iInventory != null) iInventory.setInventorySlotContents(aSlot, aStack); } } + @Override public boolean hasCustomInventoryName() { if (checkTarget()) { @@ -128,6 +135,7 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit } return false; } + @Override public boolean isItemValidForSlot(int aSlot, ItemStack aStack) { if (checkTarget()) { @@ -137,15 +145,16 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit return false; } -// // Relay Sided Inventories -// + // // Relay Sided Inventories + // @Override public int[] getAccessibleSlotsFromSide(int aSide) { if (checkTarget()) { final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity(); final IInventory iInventory = getInventory(); - if (iInventory instanceof ISidedInventory) return ((ISidedInventory)iInventory).getAccessibleSlotsFromSide(tTile.getFrontFacing()); + if (iInventory instanceof ISidedInventory) + return ((ISidedInventory) iInventory).getAccessibleSlotsFromSide(tTile.getFrontFacing()); if (iInventory != null) { final int[] tReturn = new int[iInventory.getSizeInventory()]; for (int i = 0; i < tReturn.length; i++) tReturn[i] = i; @@ -161,7 +170,8 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit if (checkTarget()) { final IGregTechTileEntity tTile = mTarget.getBaseMetaTileEntity(); IInventory iInventory = getInventory(); - if (iInventory instanceof ISidedInventory) return ((ISidedInventory)iInventory).canInsertItem(aSlot, aStack, tTile.getFrontFacing()); + if (iInventory instanceof ISidedInventory) + return ((ISidedInventory) iInventory).canInsertItem(aSlot, aStack, tTile.getFrontFacing()); return iInventory != null; } return false; @@ -176,20 +186,31 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_LongDistancePipelineItem(mName, mTier, getDescription()[0], mTextures); } + @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) - return new ITexture[]{ - MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_PIPELINE_ITEM_FRONT)}; + return new ITexture[] { + MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_ITEM_FRONT) + }; else if (aSide == GT_Utility.getOppositeSide(aFacing)) - return new ITexture[]{ - MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_PIPELINE_ITEM_BACK)}; + return new ITexture[] { + MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_PIPELINE_ITEM_BACK) + }; else - return new ITexture[]{ - MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_PIPELINE_ITEM_SIDE), - TextureFactory.builder().addIcon(OVERLAY_PIPELINE_ITEM_SIDE_GLOW).glow().build()}; + return new ITexture[] { + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_PIPELINE_ITEM_SIDE), + TextureFactory.builder() + .addIcon(OVERLAY_PIPELINE_ITEM_SIDE_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java index af6afbc4c4..3dde1feb83 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java @@ -5,7 +5,8 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; import net.minecraft.item.ItemStack; -public abstract class GT_MetaTileEntity_AbstractMultiFurnace<T extends GT_MetaTileEntity_AbstractMultiFurnace<T>> extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> { +public abstract class GT_MetaTileEntity_AbstractMultiFurnace<T extends GT_MetaTileEntity_AbstractMultiFurnace<T>> + extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> { private HeatingCoilLevel mCoilLevel; @@ -23,10 +24,10 @@ public abstract class GT_MetaTileEntity_AbstractMultiFurnace<T extends GT_MetaTi } protected boolean addBottomHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - return addMaintenanceToMachineList(aTileEntity, aBaseCasingIndex) || - addInputToMachineList(aTileEntity, aBaseCasingIndex) || - addOutputToMachineList(aTileEntity, aBaseCasingIndex) || - addEnergyInputToMachineList(aTileEntity, aBaseCasingIndex); + return addMaintenanceToMachineList(aTileEntity, aBaseCasingIndex) + || addInputToMachineList(aTileEntity, aBaseCasingIndex) + || addOutputToMachineList(aTileEntity, aBaseCasingIndex) + || addEnergyInputToMachineList(aTileEntity, aBaseCasingIndex); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index 7e3039c83b..d40b569550 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -1,10 +1,19 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_GLOW; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; + import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; @@ -24,82 +33,77 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Multi import gregtech.api.render.TextureFactory; import gregtech.api.util.*; import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_GLOW; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_AssemblyLine> implements ISurvivalConstructable { +public class GT_MetaTileEntity_AssemblyLine + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_AssemblyLine> + implements ISurvivalConstructable { public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<>(); private static final String STRUCTURE_PIECE_FIRST = "first"; private static final String STRUCTURE_PIECE_LATER = "later"; private static final String STRUCTURE_PIECE_LAST = "last"; - private static final IStructureDefinition<GT_MetaTileEntity_AssemblyLine> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_AssemblyLine>builder() - .addShape(STRUCTURE_PIECE_FIRST, transpose(new String[][]{ - {" ", "e", " "}, - {"~", "l", "G"}, - {"g", "m", "g"}, - {"b", "i", "b"}, - })) - .addShape(STRUCTURE_PIECE_LATER, transpose(new String[][]{ - {" ", "e", " "}, - {"d", "l", "d"}, - {"g", "m", "g"}, - {"b", "I", "b"}, - })) - .addShape(STRUCTURE_PIECE_LAST, transpose(new String[][]{ - {" ", "e", " "}, - {"d", "l", "d"}, - {"g", "m", "g"}, - {"o", "i", "b"}, - })) - .addElement('G', ofBlock(GregTech_API.sBlockCasings3, 10)) // grate machine casing - .addElement('l', ofBlock(GregTech_API.sBlockCasings2, 9)) // assembler machine casing - .addElement('m', ofBlock(GregTech_API.sBlockCasings2, 5)) // assembling line casing - .addElement('g', ofChain( - ofBlockUnlocalizedName("bartworks", "BW_GlasBlocks", 0, true), - ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false), //warded glass - ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true)) - ) - .addElement('e', ofChain( - Energy.newAny(16, 1), - ofBlock(GregTech_API.sBlockCasings2, 0) - )) - .addElement('d', ofChain( - DataHatchElement.DataAccess.newAny(42, 2), - ofBlock(GregTech_API.sBlockCasings3, 10) - )) - .addElement('b', buildHatchAdder(GT_MetaTileEntity_AssemblyLine.class) - .atLeast(InputHatch, InputHatch, InputHatch, InputHatch, Maintenance) - .casingIndex(16).dot(3) - .buildAndChain( - ofBlock(GregTech_API.sBlockCasings2, 0), - ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addOutputToMachineList, 16, 4) - ) - ) - .addElement('I', ofChain( - // all blocks nearby use solid steel casing, so let's use the texture of that - InputBus.newAny(16, 5), - ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addOutputToMachineList, 16, 4) - )) - .addElement('i', InputBus.newAny(16, 5)) - .addElement('o', OutputBus.newAny(16, 4)) - .build(); + private static final IStructureDefinition<GT_MetaTileEntity_AssemblyLine> STRUCTURE_DEFINITION = + StructureDefinition.<GT_MetaTileEntity_AssemblyLine>builder() + .addShape(STRUCTURE_PIECE_FIRST, transpose(new String[][] { + {" ", "e", " "}, + {"~", "l", "G"}, + {"g", "m", "g"}, + {"b", "i", "b"}, + })) + .addShape(STRUCTURE_PIECE_LATER, transpose(new String[][] { + {" ", "e", " "}, + {"d", "l", "d"}, + {"g", "m", "g"}, + {"b", "I", "b"}, + })) + .addShape(STRUCTURE_PIECE_LAST, transpose(new String[][] { + {" ", "e", " "}, + {"d", "l", "d"}, + {"g", "m", "g"}, + {"o", "i", "b"}, + })) + .addElement('G', ofBlock(GregTech_API.sBlockCasings3, 10)) // grate machine casing + .addElement('l', ofBlock(GregTech_API.sBlockCasings2, 9)) // assembler machine casing + .addElement('m', ofBlock(GregTech_API.sBlockCasings2, 5)) // assembling line casing + .addElement( + 'g', + ofChain( + ofBlockUnlocalizedName("bartworks", "BW_GlasBlocks", 0, true), + ofBlockUnlocalizedName( + "Thaumcraft", "blockCosmeticOpaque", 2, false), // warded glass + ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true))) + .addElement('e', ofChain(Energy.newAny(16, 1), ofBlock(GregTech_API.sBlockCasings2, 0))) + .addElement( + 'd', + ofChain( + DataHatchElement.DataAccess.newAny(42, 2), + ofBlock(GregTech_API.sBlockCasings3, 10))) + .addElement( + 'b', + buildHatchAdder(GT_MetaTileEntity_AssemblyLine.class) + .atLeast(InputHatch, InputHatch, InputHatch, InputHatch, Maintenance) + .casingIndex(16) + .dot(3) + .buildAndChain( + ofBlock(GregTech_API.sBlockCasings2, 0), + ofHatchAdder( + GT_MetaTileEntity_AssemblyLine::addOutputToMachineList, 16, 4))) + .addElement( + 'I', + ofChain( + // all blocks nearby use solid steel casing, so let's use the texture of that + InputBus.newAny(16, 5), + ofHatchAdder(GT_MetaTileEntity_AssemblyLine::addOutputToMachineList, 16, 4))) + .addElement('i', InputBus.newAny(16, 5)) + .addElement('o', OutputBus.newAny(16, 4)) + .build(); public GT_MetaTileEntity_AssemblyLine(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -118,48 +122,72 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Assembling Line") - .addInfo("Controller block for the Assembling Line") - .addInfo("Used to make complex machine parts (LuV+)") - .addInfo("Does not make Assembler items") - .addSeparator() - .beginVariableStructureBlock(5, 16, 4, 4, 3, 3, false)//? - .addStructureInfo("From Bottom to Top, Left to Right") - .addStructureInfo("Layer 1 - Solid Steel Machine Casing, Input Bus (last can be Output Bus), Solid Steel Machine Casing") - .addStructureInfo("Layer 2 - Borosilicate Glass(any)/Warded Glass/Reinforced Glass, Assembling Line Casing, Reinforced Glass") - .addStructureInfo("Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing") - .addStructureInfo("Layer 4 - Empty, Solid Steel Machine Casing, Empty") - .addStructureInfo("Up to 16 repeating slices, each one allows for 1 more item in recipes") - - .addController("Either Grate on layer 3 of the first slice") - .addEnergyHatch("Any layer 4 casing", 1) - .addMaintenanceHatch("Any layer 1 casing", 3) - .addInputBus("As specified on layer 1", 4, 5) - .addInputHatch("Any layer 1 casing", 3) - .addOutputBus("Replaces Input Bus on final slice or on any solid steel casing on layer 1", 4) - .addOtherStructurePart("Data Access Hatch", "Optional, next to controller", 2) - .toolTipFinisher("Gregtech"); + .addInfo("Controller block for the Assembling Line") + .addInfo("Used to make complex machine parts (LuV+)") + .addInfo("Does not make Assembler items") + .addSeparator() + .beginVariableStructureBlock(5, 16, 4, 4, 3, 3, false) // ? + .addStructureInfo("From Bottom to Top, Left to Right") + .addStructureInfo( + "Layer 1 - Solid Steel Machine Casing, Input Bus (last can be Output Bus), Solid Steel Machine Casing") + .addStructureInfo( + "Layer 2 - Borosilicate Glass(any)/Warded Glass/Reinforced Glass, Assembling Line Casing, Reinforced Glass") + .addStructureInfo("Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing") + .addStructureInfo("Layer 4 - Empty, Solid Steel Machine Casing, Empty") + .addStructureInfo("Up to 16 repeating slices, each one allows for 1 more item in recipes") + .addController("Either Grate on layer 3 of the first slice") + .addEnergyHatch("Any layer 4 casing", 1) + .addMaintenanceHatch("Any layer 1 casing", 3) + .addInputBus("As specified on layer 1", 4, 5) + .addInputHatch("Any layer 1 casing", 3) + .addOutputBus("Replaces Input Bus on final slice or on any solid steel casing on layer 1", 4) + .addOtherStructurePart("Data Access Hatch", "Optional, next to controller", 2) + .toolTipFinisher("Gregtech"); return tt; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { if (aActive) - return new ITexture[]{ + return new ITexture[] { BlockIcons.casingTexturePages[0][16], - TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { BlockIcons.casingTexturePages[0][16], - TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][16]}; + return new ITexture[] {Textures.BlockIcons.casingTexturePages[0][16]}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png"); } @Override @@ -192,13 +220,14 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu nextDataStick: for (ItemStack tDataStick : tDataStickList) { - GT_AssemblyLineUtils.LookupResult tLookupResult = GT_AssemblyLineUtils.findAssemblyLineRecipeFromDataStick(tDataStick, false); + GT_AssemblyLineUtils.LookupResult tLookupResult = + GT_AssemblyLineUtils.findAssemblyLineRecipeFromDataStick(tDataStick, false); - if (tLookupResult.getType() == GT_AssemblyLineUtils.LookupResultType.INVALID_STICK) - continue; + if (tLookupResult.getType() == GT_AssemblyLineUtils.LookupResultType.INVALID_STICK) continue; GT_Recipe_AssemblyLine tRecipe = tLookupResult.getRecipe(); - // Check if the recipe on the data stick is the current recipe for it's given output, if not we update it and continue to next. + // Check if the recipe on the data stick is the current recipe for it's given output, if not we update it + // and continue to next. if (tLookupResult.getType() != GT_AssemblyLineUtils.LookupResultType.VALID_STACK_AND_VALID_HASH) { tRecipe = GT_AssemblyLineUtils.processDataStick(tDataStick); if (tRecipe == null) { @@ -235,18 +264,21 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu for (int i = 0; i < aFluidCount; i++) { if (mInputHatches.get(i) == null) { continue nextDataStick; - }else { + } else { if (mInputHatches.get(i) instanceof GT_MetaTileEntity_Hatch_MultiInput) { - GT_MetaTileEntity_Hatch_MultiInput tMultiHatch = (GT_MetaTileEntity_Hatch_MultiInput) mInputHatches.get(i); - if (!tMultiHatch.hasFluid(tRecipe.mFluidInputs[i]) || tMultiHatch.getFluidAmount(tRecipe.mFluidInputs[i]) < tRecipe.mFluidInputs[i].amount) { + GT_MetaTileEntity_Hatch_MultiInput tMultiHatch = + (GT_MetaTileEntity_Hatch_MultiInput) mInputHatches.get(i); + if (!tMultiHatch.hasFluid(tRecipe.mFluidInputs[i]) + || tMultiHatch.getFluidAmount(tRecipe.mFluidInputs[i]) + < tRecipe.mFluidInputs[i].amount) { continue nextDataStick; } tFluids[i] = tRecipe.mFluidInputs[i].amount; tFluidSlot[i] = tMultiHatch.getFluidSlot(tRecipe.mFluidInputs[i]); - } - else { + } else { FluidStack fluidInHatch = mInputHatches.get(i).mFluid; - if (!GT_Utility.areFluidsEqual(fluidInHatch, tRecipe.mFluidInputs[i], true) || fluidInHatch.amount < tRecipe.mFluidInputs[i].amount) { + if (!GT_Utility.areFluidsEqual(fluidInHatch, tRecipe.mFluidInputs[i], true) + || fluidInHatch.amount < tRecipe.mFluidInputs[i].amount) { continue nextDataStick; } tFluids[i] = tRecipe.mFluidInputs[i].amount; @@ -261,7 +293,7 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu GT_FML_LOGGER.info("Check overclock"); } calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, getMaxInputVoltage()); - //In case recipe is too OP for that machine + // In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) { if (GT_Values.D1) { GT_FML_LOGGER.info("Recipe too OP"); @@ -271,7 +303,7 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu if (GT_Values.D1) { GT_FML_LOGGER.info("Find available recipe"); } - mOutputItems = new ItemStack[]{tRecipe.mOutput}; + mOutputItems = new ItemStack[] {tRecipe.mOutput}; foundRecipe = true; break; } @@ -281,7 +313,6 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu return false; } - if (GT_Values.D1) { GT_FML_LOGGER.info("All checked start consuming inputs"); } @@ -292,7 +323,8 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu for (int i = 0; i < tFluids.length; i++) { if (mInputHatches.get(i) instanceof GT_MetaTileEntity_Hatch_MultiInput) { - GT_MetaTileEntity_Hatch_MultiInput tMultiHatch = (GT_MetaTileEntity_Hatch_MultiInput) mInputHatches.get(i); + GT_MetaTileEntity_Hatch_MultiInput tMultiHatch = + (GT_MetaTileEntity_Hatch_MultiInput) mInputHatches.get(i); tMultiHatch.getFluid(tFluidSlot[i]).amount -= tFluids[i]; if (tMultiHatch.getFluid(tFluidSlot[i]).amount <= 0) { tMultiHatch.setFluid(null, tFluidSlot[i]); @@ -318,12 +350,10 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu } private static int isStackValidIngredient(ItemStack aSlotStack, ItemStack aIngredient, ItemStack[] alts) { - if (alts == null || alts.length == 0) - return isStackValidIngredient(aSlotStack, aIngredient); + if (alts == null || alts.length == 0) return isStackValidIngredient(aSlotStack, aIngredient); for (ItemStack tAltStack : alts) { int i = isStackValidIngredient(aSlotStack, tAltStack); - if (i >= 0) - return i; + if (i >= 0) return i; } return -1; } @@ -358,15 +388,13 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mDataAccessHatches.clear(); - if (!checkPiece(STRUCTURE_PIECE_FIRST, 0, 1, 0)) - return false; + if (!checkPiece(STRUCTURE_PIECE_FIRST, 0, 1, 0)) return false; return checkMachine(true) || checkMachine(false); } private boolean checkMachine(boolean leftToRight) { for (int i = 1; i < 16; i++) { - if (!checkPiece(STRUCTURE_PIECE_LATER, leftToRight ? -i : i, 1, 0)) - return false; + if (!checkPiece(STRUCTURE_PIECE_LATER, leftToRight ? -i : i, 1, 0)) return false; if (!mOutputBusses.isEmpty()) return !mEnergyHatches.isEmpty() && mMaintenanceHatches.size() == 1 && mDataAccessHatches.size() <= 1; } @@ -394,7 +422,7 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu if (isValidMetaTileEntity(tHatch)) { for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) { if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null - && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state)) + && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state)) rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); } } @@ -440,14 +468,17 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu @Override public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) { if (mMachine) return -1; - int build = survivialBuildPiece(STRUCTURE_PIECE_FIRST, stackSize, 0, 1, 0, elementBudget, source, actor, false, true); + int build = survivialBuildPiece( + STRUCTURE_PIECE_FIRST, stackSize, 0, 1, 0, elementBudget, source, actor, false, true); if (build >= 0) return build; int tLength = Math.min(stackSize.stackSize + 1, 16); for (int i = 1; i < tLength - 1; i++) { - build = survivialBuildPiece(STRUCTURE_PIECE_LATER, stackSize, -i, 1, 0, elementBudget, source, actor, false, true); + build = survivialBuildPiece( + STRUCTURE_PIECE_LATER, stackSize, -i, 1, 0, elementBudget, source, actor, false, true); if (build >= 0) return build; } - return survivialBuildPiece(STRUCTURE_PIECE_LAST, stackSize, 1 - tLength, 1, 0, elementBudget, source, actor, false); + return survivialBuildPiece( + STRUCTURE_PIECE_LAST, stackSize, 1 - tLength, 1, 0, elementBudget, source, actor, false); } private enum DataHatchElement implements IHatchElement<GT_MetaTileEntity_AssemblyLine> { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java index e55837ab2d..adf09ad6db 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java @@ -13,12 +13,18 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import net.minecraft.block.Block; import org.lwjgl.input.Keyboard; -public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_PrimitiveBlastFurnace implements ISecondaryDescribable { +public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_PrimitiveBlastFurnace + implements ISecondaryDescribable { private static final ITexture[] FACING_SIDE = {TextureFactory.of(Textures.BlockIcons.MACHINE_CASING_DENSEBRICKS)}; - private static final ITexture[] FACING_FRONT = {TextureFactory.of(Textures.BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_INACTIVE)}; + private static final ITexture[] FACING_FRONT = { + TextureFactory.of(Textures.BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_INACTIVE) + }; private static final ITexture[] FACING_ACTIVE = { - TextureFactory.of(Textures.BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_ACTIVE), - TextureFactory.builder().addIcon(BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_ACTIVE_GLOW).glow().build() + TextureFactory.of(Textures.BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_ACTIVE), + TextureFactory.builder() + .addIcon(BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_ACTIVE_GLOW) + .glow() + .build() }; public GT_MetaTileEntity_BrickedBlastFurnace(int aID, String aName, String aNameRegional) { @@ -66,7 +72,13 @@ public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_Pri } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { return aActive ? FACING_ACTIVE : FACING_FRONT; } @@ -93,4 +105,3 @@ public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_Pri return "Bricked Blast Furnace"; } } - diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java index 93b36d376c..9bccfa3376 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java @@ -1,5 +1,10 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -7,17 +12,15 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.render.TextureFactory; import net.minecraft.block.Block; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS; - public class GT_MetaTileEntity_BronzeBlastFurnace extends GT_MetaTileEntity_PrimitiveBlastFurnace { private static final ITexture[] FACING_SIDE = {TextureFactory.of(MACHINE_BRONZEPLATEDBRICKS)}; private static final ITexture[] FACING_FRONT = {TextureFactory.of(MACHINE_BRONZEBLASTFURNACE)}; private static final ITexture[] FACING_ACTIVE = { - TextureFactory.of(MACHINE_BRONZEBLASTFURNACE_ACTIVE), - TextureFactory.builder().addIcon(MACHINE_BRONZEBLASTFURNACE_ACTIVE_GLOW).glow().build() + TextureFactory.of(MACHINE_BRONZEBLASTFURNACE_ACTIVE), + TextureFactory.builder() + .addIcon(MACHINE_BRONZEBLASTFURNACE_ACTIVE_GLOW) + .glow() + .build() }; public GT_MetaTileEntity_BronzeBlastFurnace(int aID, String aName, String aNameRegional) { @@ -30,11 +33,17 @@ public class GT_MetaTileEntity_BronzeBlastFurnace extends GT_MetaTileEntity_Prim @Override public String[] getDescription() { - return new String[]{"Disabled"}; + return new String[] {"Disabled"}; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { return aActive ? FACING_ACTIVE : FACING_FRONT; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java index 5f6a34832e..8a2f969b18 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java @@ -1,9 +1,16 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.ParticleFX; import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.ParticleFX; import gregtech.api.interfaces.ISecondaryDescribable; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -14,6 +21,7 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.common.GT_Pollution; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -22,17 +30,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.ChunkPosition; import net.minecraftforge.oredict.OreDictionary; -import java.util.ArrayList; - -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; - -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - -public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMultiBlockBase implements ISecondaryDescribable { +public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMultiBlockBase + implements ISecondaryDescribable { private boolean running = false; @@ -80,7 +79,7 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMul mEfficiencyIncrease = 10000; mMaxProgresstime = Math.max(1, mMaxProgresstime); - //adds all the pollution at once when the recipe starts + // adds all the pollution at once when the recipe starts GT_Pollution.addPollution(getBaseMetaTileEntity(), mMaxProgresstime * getPollutionPerTick(null)); return true; } else { @@ -108,8 +107,18 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMul } if (running) { for (ChunkPosition tPos : tList1) { - if (isWoodLog(getBaseMetaTileEntity().getBlockOffset(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ), getBaseMetaTileEntity().getMetaIDOffset(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ))) - getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + tPos.chunkPosX, getBaseMetaTileEntity().getYCoord() + tPos.chunkPosY, getBaseMetaTileEntity().getZCoord() + tPos.chunkPosZ, GregTech_API.sBlockReinforced, 4, 3); + if (isWoodLog( + getBaseMetaTileEntity().getBlockOffset(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ), + getBaseMetaTileEntity().getMetaIDOffset(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ))) + getBaseMetaTileEntity() + .getWorld() + .setBlock( + getBaseMetaTileEntity().getXCoord() + tPos.chunkPosX, + getBaseMetaTileEntity().getYCoord() + tPos.chunkPosY, + getBaseMetaTileEntity().getZCoord() + tPos.chunkPosZ, + GregTech_API.sBlockReinforced, + 4, + 3); } running = false; return false; @@ -122,14 +131,16 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMul private boolean isWoodLog(Block log, int meta) { for (int id : OreDictionary.getOreIDs(new ItemStack(log, 1, meta))) { - if (OreDictionary.getOreName(id).equals("logWood")) - return true; + if (OreDictionary.getOreName(id).equals("logWood")) return true; } String tTool = log.getHarvestTool(meta); - return OrePrefixes.log.contains(new ItemStack(log, 1, meta)) && ("axe".equals(tTool)) && (log.getMaterial() == Material.wood); + return OrePrefixes.log.contains(new ItemStack(log, 1, meta)) + && ("axe".equals(tTool)) + && (log.getMaterial() == Material.wood); } - private boolean checkAllBlockSides(int aX, int aY, int aZ, ArrayList<? super ChunkPosition> aList1, ArrayList<? super ChunkPosition> aList2) { + private boolean checkAllBlockSides( + int aX, int aY, int aZ, ArrayList<? super ChunkPosition> aList1, ArrayList<? super ChunkPosition> aList2) { boolean expandToChunkXPos = false; boolean expandToChunkXNeg = false; boolean expandToChunkYPos = false; @@ -139,48 +150,50 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMul Block blockXPos = getBaseMetaTileEntity().getBlockOffset(aX + 1, aY, aZ); if (aX + 1 < 6 && (isWoodLog(blockXPos, getBaseMetaTileEntity().getMetaIDOffset(aX + 1, aY, aZ)))) { - if (!aList1.contains(new ChunkPosition(aX + 1, aY, aZ)) && (!aList2.contains(new ChunkPosition(aX + 1, aY, aZ)))) - expandToChunkXPos = true; + if (!aList1.contains(new ChunkPosition(aX + 1, aY, aZ)) + && (!aList2.contains(new ChunkPosition(aX + 1, aY, aZ)))) expandToChunkXPos = true; } else if (!(blockXPos == Blocks.dirt || blockXPos == Blocks.grass)) { return false; } Block blockXNeg = getBaseMetaTileEntity().getBlockOffset(aX - 1, aY, aZ); if (aX - 1 > -6 && (isWoodLog(blockXNeg, getBaseMetaTileEntity().getMetaIDOffset(aX - 1, aY, aZ)))) { - if (!aList1.contains(new ChunkPosition(aX - 1, aY, aZ)) && (!aList2.contains(new ChunkPosition(aX - 1, aY, aZ)))) - expandToChunkXNeg = true; + if (!aList1.contains(new ChunkPosition(aX - 1, aY, aZ)) + && (!aList2.contains(new ChunkPosition(aX - 1, aY, aZ)))) expandToChunkXNeg = true; } else if (!(blockXNeg == Blocks.dirt || blockXNeg == Blocks.grass)) { return false; } Block blockYPos = getBaseMetaTileEntity().getBlockOffset(aX, aY + 1, aZ); if (aY + 1 < 1 && (isWoodLog(blockYPos, getBaseMetaTileEntity().getMetaIDOffset(aX, aY + 1, aZ)))) { - if (!aList1.contains(new ChunkPosition(aX, aY + 1, aZ)) && (!aList2.contains(new ChunkPosition(aX, aY + 1, aZ)))) - expandToChunkYPos = true; - } else if (!(blockYPos == Blocks.dirt || blockYPos == Blocks.grass || (aX == 0 && aY == -1 && aZ == 0 && blockYPos == GregTech_API.sBlockMachines))) { + if (!aList1.contains(new ChunkPosition(aX, aY + 1, aZ)) + && (!aList2.contains(new ChunkPosition(aX, aY + 1, aZ)))) expandToChunkYPos = true; + } else if (!(blockYPos == Blocks.dirt + || blockYPos == Blocks.grass + || (aX == 0 && aY == -1 && aZ == 0 && blockYPos == GregTech_API.sBlockMachines))) { return false; } Block blockYNeg = getBaseMetaTileEntity().getBlockOffset(aX, aY - 1, aZ); if (aY - 1 > -6 && (isWoodLog(blockYNeg, getBaseMetaTileEntity().getMetaIDOffset(aX, aY - 1, aZ)))) { - if (!aList1.contains(new ChunkPosition(aX, aY - 1, aZ)) && (!aList2.contains(new ChunkPosition(aX, aY - 1, aZ)))) - expandToChunkYNeg = true; + if (!aList1.contains(new ChunkPosition(aX, aY - 1, aZ)) + && (!aList2.contains(new ChunkPosition(aX, aY - 1, aZ)))) expandToChunkYNeg = true; } else if (blockYNeg != Blocks.brick_block) { return false; } Block blockZPos = getBaseMetaTileEntity().getBlockOffset(aX, aY, aZ + 1); if (aZ + 1 < 6 && (isWoodLog(blockZPos, getBaseMetaTileEntity().getMetaIDOffset(aX, aY, aZ + 1)))) { - if (!aList1.contains(new ChunkPosition(aX, aY, aZ + 1)) && (!aList2.contains(new ChunkPosition(aX, aY, aZ + 1)))) - expandToChunkZPos = true; + if (!aList1.contains(new ChunkPosition(aX, aY, aZ + 1)) + && (!aList2.contains(new ChunkPosition(aX, aY, aZ + 1)))) expandToChunkZPos = true; } else if (!(blockZPos == Blocks.dirt || blockZPos == Blocks.grass)) { return false; } Block blockZNeg = getBaseMetaTileEntity().getBlockOffset(aX, aY, aZ - 1); if (aZ - 1 > -6 && (isWoodLog(blockZNeg, getBaseMetaTileEntity().getMetaIDOffset(aX, aY, aZ - 1)))) { - if (!aList1.contains(new ChunkPosition(aX, aY, aZ - 1)) && (!aList2.contains(new ChunkPosition(aX, aY, aZ - 1)))) - expandToChunkZNeg = true; + if (!aList1.contains(new ChunkPosition(aX, aY, aZ - 1)) + && (!aList2.contains(new ChunkPosition(aX, aY, aZ - 1)))) expandToChunkZNeg = true; } else if (!(blockZNeg == Blocks.dirt || blockZNeg == Blocks.grass)) { return false; } @@ -254,19 +267,33 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMul } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == 1) { - if (aActive) return new ITexture[]{ + if (aActive) + return new ITexture[] { casingTexturePages[0][10], TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()}; - return new ITexture[]{ - casingTexturePages[0][10], - TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW).glow().build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW) + .glow() + .build() + }; + return new ITexture[] { + casingTexturePages[0][10], + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ROCK_BREAKER_GLOW) + .glow() + .build(), }; } - return new ITexture[]{casingTexturePages[0][10]}; + return new ITexture[] {casingTexturePages[0][10]}; } @Override @@ -282,13 +309,12 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_TooltipMul if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { new WorldSpawnedEventBuilder.ParticleEventBuilder() - .setMotion(0D,0.3D,0D) + .setMotion(0D, 0.3D, 0D) .setIdentifier(ParticleFX.LARGE_SMOKE) .setPosition( aBaseMetaTileEntity.getOffsetX((byte) 1, 1) + XSTR_INSTANCE.nextFloat(), aBaseMetaTileEntity.getOffsetY((byte) 1, 1), - aBaseMetaTileEntity.getOffsetZ((byte) 1, 1) + XSTR_INSTANCE.nextFloat() - ) + aBaseMetaTileEntity.getOffsetZ((byte) 1, 1) + XSTR_INSTANCE.nextFloat()) .setWorld(getBaseMetaTileEntity().getWorld()) .run(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index 6b167654b4..ae935a06bb 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.GT_Values.debugCleanroom; +import static gregtech.api.enums.Textures.BlockIcons.*; + import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import gregtech.api.GregTech_API; @@ -16,6 +19,8 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; +import java.util.HashMap; +import java.util.Map; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -25,13 +30,8 @@ import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.util.ForgeDirection; -import java.util.HashMap; -import java.util.Map; - -import static gregtech.api.enums.GT_Values.debugCleanroom; -import static gregtech.api.enums.Textures.BlockIcons.*; - -public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiBlockBase implements IConstructable, ISecondaryDescribable { +public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiBlockBase + implements IConstructable, ISecondaryDescribable { private int mHeight = -1; public GT_MetaTileEntity_Cleanroom(int aID, String aName, String aNameRegional) { @@ -50,35 +50,36 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Cleanroom") - .addInfo("Controller block for the Cleanroom") - .addInfo("Consumes 40 EU/t when first turned on") - .addInfo("and 4 EU/t once at 100% efficiency when not overclocked")//? - .addInfo("An energy hatch accepts up to 2A, so you can use 2A LV or 1A MV") - .addInfo("2 LV batteries + 1 LV generator or 1 MV generator")//? - .addInfo("Time required to reach full efficiency is proportional to") - .addInfo("the height of empty space within") - .addInfo("Make sure your Energy Hatch matches! ?") - .addInfo("Machines that cause pollution aren't allowed to be put in.") - .addSeparator() - .beginVariableStructureBlock(3, 15, 4, 15, 3, 15, true) - .addController("Top center") - .addCasingInfo("Plascrete", 20) - .addStructureInfo(GT_Values.cleanroomGlass + "% of the Plascrete can be replaced with Reinforced Glass")//check - .addStructureInfo("Other material can be used in place of Plascrete. See config for detail")//check - .addOtherStructurePart("Filter Machine Casing", "Top besides controller and edges") - .addEnergyHatch("Any casing. Exactly one.")//check - .addMaintenanceHatch("Any casing") - .addStructureInfo("1x Reinforced Door (keep closed or efficiency will reduce)") - .addStructureInfo("Up to 10 Machine Hulls for Item & Energy transfer through walls") - .addStructureInfo("You can also use Diodes for more power") - .addStructureInfo("Diodes also count towards 10 Machine Hulls count limit") - .toolTipFinisher("Gregtech"); + .addInfo("Controller block for the Cleanroom") + .addInfo("Consumes 40 EU/t when first turned on") + .addInfo("and 4 EU/t once at 100% efficiency when not overclocked") // ? + .addInfo("An energy hatch accepts up to 2A, so you can use 2A LV or 1A MV") + .addInfo("2 LV batteries + 1 LV generator or 1 MV generator") // ? + .addInfo("Time required to reach full efficiency is proportional to") + .addInfo("the height of empty space within") + .addInfo("Make sure your Energy Hatch matches! ?") + .addInfo("Machines that cause pollution aren't allowed to be put in.") + .addSeparator() + .beginVariableStructureBlock(3, 15, 4, 15, 3, 15, true) + .addController("Top center") + .addCasingInfo("Plascrete", 20) + .addStructureInfo( + GT_Values.cleanroomGlass + "% of the Plascrete can be replaced with Reinforced Glass") // check + .addStructureInfo("Other material can be used in place of Plascrete. See config for detail") // check + .addOtherStructurePart("Filter Machine Casing", "Top besides controller and edges") + .addEnergyHatch("Any casing. Exactly one.") // check + .addMaintenanceHatch("Any casing") + .addStructureInfo("1x Reinforced Door (keep closed or efficiency will reduce)") + .addStructureInfo("Up to 10 Machine Hulls for Item & Energy transfer through walls") + .addStructureInfo("You can also use Diodes for more power") + .addStructureInfo("Diodes also count towards 10 Machine Hulls count limit") + .toolTipFinisher("Gregtech"); return tt; } @Override public String[] getStructureDescription(ItemStack itemStack) { - return new String[] { "The structure in both X and Z axis has to be a square." }; + return new String[] {"The structure in both X and Z axis has to be a square."}; } @Override @@ -86,7 +87,8 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB mEfficiencyIncrease = 100; // use the standard overclock mechanism to determine duration and estimate a maximum consumption calculateOverclockedNessMulti(40, 45 * Math.max(1, mHeight - 1), 1, getMaxInputVoltage()); - // negate it to trigger the special energy consumption function. divide by 10 to get the actual final consumption. + // negate it to trigger the special energy consumption function. divide by 10 to get the actual final + // consumption. mEUt /= -10; return true; } @@ -109,9 +111,7 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB this.mUpdate = 100; if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Checking machine" - ); + GT_Log.out.println("Cleanroom: Checking machine"); } for (int i = 1; i < 8; i++) { Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, 0, 0); @@ -143,7 +143,7 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB } } } - //detect room square for filters + // detect room square for filters for (int i = -x + 1; i < x; i++) { for (int j = -z + 1; j < z; j++) { if (i == 0 && j == 0) continue; @@ -165,9 +165,7 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB } if (y > -2) { if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Room not tall enough?" - ); + GT_Log.out.println("Cleanroom: Room not tall enough?"); } return false; } @@ -177,22 +175,19 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB if (dX == -x || dX == x || dY == 0 || dY == y || dZ == -z || dZ == z) { Block tBlock = aBaseMetaTileEntity.getBlockOffset(dX, dY, dZ); int tMeta = aBaseMetaTileEntity.getMetaIDOffset(dX, dY, dZ); - if (dY == 0) { // TOP - if (dX == -x || dX == x || dZ == -z || dZ == z) { // Top Border + if (dY == 0) { // TOP + if (dX == -x || dX == x || dZ == -z || dZ == z) { // Top Border if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) { if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Non reinforced block on top edge? tMeta != 2" - ); + GT_Log.out.println("Cleanroom: Non reinforced block on top edge? tMeta != 2"); } return false; } - } else if (dX != 0 || dZ != 0) { // Top Inner exclude center + } else if (dX != 0 || dZ != 0) { // Top Inner exclude center if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { if (debugCleanroom) { GT_Log.out.println( - "Cleanroom: Non reinforced block on top face interior? tMeta != 11" - ); + "Cleanroom: Non reinforced block on top face interior? tMeta != 11"); } return false; } @@ -200,15 +195,17 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB } else if (tBlock == GregTech_API.sBlockReinforced && tMeta == 2) { mPlascreteCount++; } else { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ); - if ((!this.addMaintenanceToMachineList(tTileEntity, 210)) && (!this.addEnergyInputToMachineList(tTileEntity, 210))) { + IGregTechTileEntity tTileEntity = + aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ); + if ((!this.addMaintenanceToMachineList(tTileEntity, 210)) + && (!this.addEnergyInputToMachineList(tTileEntity, 210))) { if (tBlock instanceof ic2.core.block.BlockIC2Door) { if ((tMeta & 8) == 0) { // let's not fiddle with bits anymore. if (Math.abs(dZ) < z) // on side parallel to z axis - doorState = tMeta == 1 || tMeta == 3 || tMeta == 4 || tMeta == 6; + doorState = tMeta == 1 || tMeta == 3 || tMeta == 4 || tMeta == 6; else if (Math.abs(dX) < x) // on side parallel to x axis - doorState = tMeta == 0 || tMeta == 2 || tMeta == 5 || tMeta == 7; + doorState = tMeta == 0 || tMeta == 2 || tMeta == 5 || tMeta == 7; // corners ignored } mDoorCount++; @@ -217,37 +214,31 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) { if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Missing block? Not a aMetaTileEntity" - ); + GT_Log.out.println("Cleanroom: Missing block? Not a aMetaTileEntity"); } return false; } if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicHull) { mHullCount++; - } - else { + } else { if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Incorrect GT block? " + tBlock.getUnlocalizedName() - ); + GT_Log.out.println("Cleanroom: Incorrect GT block? " + + tBlock.getUnlocalizedName()); } return false; } - } - else { - String key = tBlock.getUnlocalizedName() + ":"+ tMeta; + } else { + String key = tBlock.getUnlocalizedName() + ":" + tMeta; if (config.containsKey(key)) { // check with meta first otherBlocks.compute(key, (k, v) -> v == null ? 1 : v + 1); - } - else { + } else { key = tBlock.getUnlocalizedName(); if (config.containsKey(key)) { otherBlocks.compute(key, (k, v) -> v == null ? 1 : v + 1); - } - else { + } else { if (debugCleanroom) - GT_Log.out.println("Cleanroom: not allowed block " + tBlock.getUnlocalizedName()); + GT_Log.out.println("Cleanroom: not allowed block " + + tBlock.getUnlocalizedName()); return false; } } @@ -259,19 +250,19 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB } } } - if (this.mMaintenanceHatches.size() != 1 || this.mEnergyHatches.size() != 1 || mDoorCount > 2 || mHullCount > 10) { + if (this.mMaintenanceHatches.size() != 1 + || this.mEnergyHatches.size() != 1 + || mDoorCount > 2 + || mHullCount > 10) { return false; } - if (mPlascreteCount < 20) - return false; + if (mPlascreteCount < 20) return false; float ratio = (((float) mPlascreteCount) / 100f); for (Map.Entry<String, Integer> e : otherBlocks.entrySet()) { ConfigEntry ce = config.get(e.getKey()); if (ce.allowedCount > 0) { // count has priority - if (e.getValue() > ce.allowedCount) - return false; - } else if (e.getValue() > ratio * ce.percentage) - return false; + if (e.getValue() > ce.allowedCount) return false; + } else if (e.getValue() > ratio * ce.percentage) return false; } setCallbacks(x, y, z, aBaseMetaTileEntity); @@ -316,9 +307,8 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB @SuppressWarnings("unchecked") private void checkAndSetCallback(IMachineCallback<?> iMachineCallback) { if (debugCleanroom) - GT_Log.out.println( - "Cleanroom: IMachineCallback detected, checking for cleanroom: " + (iMachineCallback.getType() == this.getClass()) - ); + GT_Log.out.println("Cleanroom: IMachineCallback detected, checking for cleanroom: " + + (iMachineCallback.getType() == this.getClass())); if (iMachineCallback.getType() == this.getClass()) ((IMachineCallback<GT_MetaTileEntity_Cleanroom>) iMachineCallback).setCallbackBase(this); } @@ -329,24 +319,38 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == ForgeDirection.DOWN.ordinal() || aSide == ForgeDirection.UP.ordinal()) { - return new ITexture[]{ - TextureFactory.of(BLOCK_PLASCRETE), - aActive ? - TextureFactory.of( - TextureFactory.of(OVERLAY_TOP_CLEANROOM_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_CLEANROOM_ACTIVE_GLOW).glow().build()) : - TextureFactory.of( - TextureFactory.of(OVERLAY_TOP_CLEANROOM), - TextureFactory.builder().addIcon(OVERLAY_TOP_CLEANROOM_GLOW).glow().build())}; + return new ITexture[] { + TextureFactory.of(BLOCK_PLASCRETE), + aActive + ? TextureFactory.of( + TextureFactory.of(OVERLAY_TOP_CLEANROOM_ACTIVE), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_CLEANROOM_ACTIVE_GLOW) + .glow() + .build()) + : TextureFactory.of( + TextureFactory.of(OVERLAY_TOP_CLEANROOM), + TextureFactory.builder() + .addIcon(OVERLAY_TOP_CLEANROOM_GLOW) + .glow() + .build()) + }; } - return new ITexture[]{TextureFactory.of(BLOCK_PLASCRETE)}; + return new ITexture[] {TextureFactory.of(BLOCK_PLASCRETE)}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); } @Override @@ -383,25 +387,16 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB int y = baseEntity.getYCoord(); int z = baseEntity.getZCoord(); int yoff = Math.max(i * 2, 3); - for(int X = x - i; X <= x + i; X++) - for(int Y = y; Y >= y - yoff; Y--) - for(int Z = z - i; Z <= z + i; Z++) - { - if(X == x && Y == y && Z == z) - continue; - if(X == x - i || X == x + i || Z == z - i || Z == z + i || Y == y - yoff) - { - if (b) - StructureLibAPI.hintParticle(world, X, Y, Z, GregTech_API.sBlockReinforced, 2); - else - world.setBlock(X, Y, Z, GregTech_API.sBlockReinforced, 2, 2); - } - else if(Y == y) - { - if (b) - StructureLibAPI.hintParticle(world, X, Y, Z, GregTech_API.sBlockCasings3, 11); - else - world.setBlock(X, Y, Z, GregTech_API.sBlockCasings3, 11, 2); + for (int X = x - i; X <= x + i; X++) + for (int Y = y; Y >= y - yoff; Y--) + for (int Z = z - i; Z <= z + i; Z++) { + if (X == x && Y == y && Z == z) continue; + if (X == x - i || X == x + i || Z == z - i || Z == z + i || Y == y - yoff) { + if (b) StructureLibAPI.hintParticle(world, X, Y, Z, GregTech_API.sBlockReinforced, 2); + else world.setBlock(X, Y, Z, GregTech_API.sBlockReinforced, 2, 2); + } else if (Y == y) { + if (b) StructureLibAPI.hintParticle(world, X, Y, Z, GregTech_API.sBlockCasings3, 11); + else world.setBlock(X, Y, Z, GregTech_API.sBlockCasings3, 11, 2); } } } @@ -410,49 +405,56 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_TooltipMultiB int percentage; int allowedCount; int meta; + ConfigEntry(int percentage, int count, int meta) { this.percentage = percentage; this.allowedCount = count; this.meta = meta; } } - private final static HashMap<String, ConfigEntry> config = new HashMap<>(); + + private static final HashMap<String, ConfigEntry> config = new HashMap<>(); private static final String category = "cleanroom_allowed_blocks"; private static final int wildcard_meta = Short.MAX_VALUE; private static void setDefaultConfigValues(Configuration cfg) { - cfg.get("cleanroom_allowed_blocks.reinforced_glass", "Name","blockAlloyGlass"); - cfg.get("cleanroom_allowed_blocks.reinforced_glass", "Percentage",5); - cfg.get("cleanroom_allowed_blocks.bw_reinforced_glass_0", "Name","BW_GlasBlocks"); - cfg.get("cleanroom_allowed_blocks.bw_reinforced_glass_0", "Percentage",50); - cfg.get("cleanroom_allowed_blocks.bw_reinforced_glass_0", "Meta",0); - cfg.get("cleanroom_allowed_blocks.bw_reinforced_glass", "Name","BW_GlasBlocks"); - cfg.get("cleanroom_allowed_blocks.bw_reinforced_glass", "Percentage",100); - cfg.get("cleanroom_allowed_blocks.elevator", "Name","tile.openblocks.elevator"); - cfg.get("cleanroom_allowed_blocks.elevator", "Count",1); - cfg.get("cleanroom_allowed_blocks.travel_anchor", "Name","tile.blockTravelAnchor"); - cfg.get("cleanroom_allowed_blocks.travel_anchor", "Count",1); - cfg.get("cleanroom_allowed_blocks.warded_glass", "Name","tile.blockCosmeticOpaque"); - cfg.get("cleanroom_allowed_blocks.warded_glass", "Meta",2); - cfg.get("cleanroom_allowed_blocks.warded_glass", "Percentage",50); + cfg.get("cleanroom_allowed_blocks.reinforced_glass", "Name", "blockAlloyGlass"); + cfg.get("cleanroom_allowed_blocks.reinforced_glass", "Percentage", 5); + cfg.get("cleanroom_allowed_blocks.bw_reinforced_glass_0", "Name", "BW_GlasBlocks"); + cfg.get("cleanroom_allowed_blocks.bw_reinforced_glass_0", "Percentage", 50); + cfg.get("cleanroom_allowed_blocks.bw_reinforced_glass_0", "Meta", 0); + cfg.get("cleanroom_allowed_blocks.bw_reinforced_glass", "Name", "BW_GlasBlocks"); + cfg.get("cleanroom_allowed_blocks.bw_reinforced_glass", "Percentage", 100); + cfg.get("cleanroom_allowed_blocks.elevator", "Name", "tile.openblocks.elevator"); + cfg.get("cleanroom_allowed_blocks.elevator", "Count", 1); + cfg.get("cleanroom_allowed_blocks.travel_anchor", "Name", "tile.blockTravelAnchor"); + cfg.get("cleanroom_allowed_blocks.travel_anchor", "Count", 1); + cfg.get("cleanroom_allowed_blocks.warded_glass", "Name", "tile.blockCosmeticOpaque"); + cfg.get("cleanroom_allowed_blocks.warded_glass", "Meta", 2); + cfg.get("cleanroom_allowed_blocks.warded_glass", "Percentage", 50); } + public static void loadConfig(Configuration cfg) { - if (!cfg.hasCategory(category)) - setDefaultConfigValues(cfg); + if (!cfg.hasCategory(category)) setDefaultConfigValues(cfg); for (ConfigCategory cc : cfg.getCategory(category).getChildren()) { String name = cc.get("Name").getString(); if (cc.containsKey("Count")) { if (cc.containsKey("Meta")) - config.put(name+":"+cc.get("Meta").getInt(), new ConfigEntry(0, cc.get("Count").getInt(), cc.get("Meta").getInt())); - else - config.put(name, new ConfigEntry(0, cc.get("Count").getInt(), wildcard_meta)); - } - else if (cc.containsKey("Percentage")) { + config.put( + name + ":" + cc.get("Meta").getInt(), + new ConfigEntry( + 0, cc.get("Count").getInt(), cc.get("Meta").getInt())); + else config.put(name, new ConfigEntry(0, cc.get("Count").getInt(), wildcard_meta)); + } else if (cc.containsKey("Percentage")) { if (cc.containsKey("Meta")) - config.put(name+":"+cc.get("Meta").getInt(), new ConfigEntry(cc.get("Percentage").getInt(), 0, cc.get("Meta").getInt())); - else - config.put(name, new ConfigEntry(cc.get("Percentage").getInt(), 0, wildcard_meta)); + config.put( + name + ":" + cc.get("Meta").getInt(), + new ConfigEntry( + cc.get("Percentage").getInt(), + 0, + cc.get("Meta").getInt())); + else config.put(name, new ConfigEntry(cc.get("Percentage").getInt(), 0, wildcard_meta)); } } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java index 52bc0b66e4..873c5bf769 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.GT_Values.VN; + import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -9,8 +11,6 @@ import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.GT_Values.VN; - public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTileEntity_DrillerBase { private int mLastXOff = 0, mLastZOff = 0; @@ -27,30 +27,31 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi String casings = getCasingBlockItem().get(0).getDisplayName(); final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Concrete Backfiller") - .addInfo("Controller Block for the " + aStructureName) - .addInfo("Will fill in areas below it with light concrete. This goes through walls") - .addInfo("Use it to remove any spawning locations beneath your base to reduce lag") - .addInfo("Will pull back the pipes after it finishes that layer") - .addInfo("Radius is " + getRadius() + " blocks") - .addSeparator() - .beginStructureBlock(3, 7, 3, false) - .addController("Front bottom") - .addOtherStructurePart(casings, "form the 3x1x3 Base") - .addOtherStructurePart(casings, "1x3x1 pillar above the center of the base (2 minimum total)") - .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top") - .addEnergyHatch(VN[getMinTier()] + "+, Any base casing", 1) - .addMaintenanceHatch("Any base casing", 1) - .addInputBus("Mining Pipes, optional, any base casing", 1) - .addInputHatch("GT Concrete, any base casing", 1) - .addOutputBus("Mining Pipes, optional, any base casing", 1) - .toolTipFinisher("Gregtech"); - return tt; + tt.addMachineType("Concrete Backfiller") + .addInfo("Controller Block for the " + aStructureName) + .addInfo("Will fill in areas below it with light concrete. This goes through walls") + .addInfo("Use it to remove any spawning locations beneath your base to reduce lag") + .addInfo("Will pull back the pipes after it finishes that layer") + .addInfo("Radius is " + getRadius() + " blocks") + .addSeparator() + .beginStructureBlock(3, 7, 3, false) + .addController("Front bottom") + .addOtherStructurePart(casings, "form the 3x1x3 Base") + .addOtherStructurePart(casings, "1x3x1 pillar above the center of the base (2 minimum total)") + .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top") + .addEnergyHatch(VN[getMinTier()] + "+, Any base casing", 1) + .addMaintenanceHatch("Any base casing", 1) + .addInputBus("Mining Pipes, optional, any base casing", 1) + .addInputHatch("GT Concrete, any base casing", 1) + .addOutputBus("Mining Pipes, optional, any base casing", 1) + .toolTipFinisher("Gregtech"); + return tt; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png"); } protected abstract int getRadius(); @@ -71,18 +72,18 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi } @Override - protected boolean workingUpward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { - if (isRefillableBlock(xPipe, yHead - 1, zPipe)) - return tryRefillBlock(xPipe, yHead - 1, zPipe); + protected boolean workingUpward( + ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { + if (isRefillableBlock(xPipe, yHead - 1, zPipe)) return tryRefillBlock(xPipe, yHead - 1, zPipe); int radius = getRadius(); if (mLastXOff == 0 && mLastZOff == 0) { - mLastXOff = - radius; - mLastZOff = - radius; + mLastXOff = -radius; + mLastZOff = -radius; } if (yHead != yDrill) { for (int i = mLastXOff; i <= radius; i++) { - for (int j = (i == mLastXOff ? mLastZOff : - radius); j <= radius; j++) { - if (isRefillableBlock(xPipe + i, yHead, zPipe + j)){ + for (int j = (i == mLastXOff ? mLastZOff : -radius); j <= radius; j++) { + if (isRefillableBlock(xPipe + i, yHead, zPipe + j)) { mLastXOff = i; mLastZOff = j; return tryRefillBlock(xPipe + i, yHead, zPipe + j); @@ -102,10 +103,12 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi } } - private boolean isRefillableBlock(int aX, int aY, int aZ){ + private boolean isRefillableBlock(int aX, int aY, int aZ) { IGregTechTileEntity aBaseTile = getBaseMetaTileEntity(); - if (!aBaseTile.getBlock(aX, aY, aZ).isAir(aBaseTile.getWorld(), aX, aY, aZ) || aBaseTile.getBlock(aX, aY, aZ).getMaterial().isSolid()) return false; - if (!GT_Utility.setBlockByFakePlayer(getFakePlayer(aBaseTile), aX, aY, aZ, GregTech_API.sBlockConcretes, 8, true)) return false; + if (!aBaseTile.getBlock(aX, aY, aZ).isAir(aBaseTile.getWorld(), aX, aY, aZ) + || aBaseTile.getBlock(aX, aY, aZ).getMaterial().isSolid()) return false; + if (!GT_Utility.setBlockByFakePlayer( + getFakePlayer(aBaseTile), aX, aY, aZ, GregTech_API.sBlockConcretes, 8, true)) return false; return true; } @@ -116,11 +119,10 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi } private boolean tryConsumeFluid() { - if (!depleteInput(Materials.Concrete.getMolten(144L))){ + if (!depleteInput(Materials.Concrete.getMolten(144L))) { mMaxProgresstime = 0; return false; } return true; } - } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java index 29997c5452..ecf31c240c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java @@ -1,5 +1,19 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.Dynamo; +import static gregtech.api.enums.GT_HatchElement.InputHatch; +import static gregtech.api.enums.GT_HatchElement.Maintenance; +import static gregtech.api.enums.GT_HatchElement.Muffler; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; + import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -18,6 +32,7 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; @@ -27,49 +42,38 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Dynamo; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; - -public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_DieselEngine> implements ISurvivalConstructable { +public class GT_MetaTileEntity_DieselEngine + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_DieselEngine> + implements ISurvivalConstructable { private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_DieselEngine>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_DieselEngine>>() { - @Override - protected IStructureDefinition<GT_MetaTileEntity_DieselEngine> computeValue(Class<?> type) { - return StructureDefinition.<GT_MetaTileEntity_DieselEngine>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {"---", "iii", "chc", "chc", "ccc", }, - {"---", "i~i", "hgh", "hgh", "cdc", }, - {"---", "iii", "chc", "chc", "ccc", }, - })) - .addElement('i', lazy(t -> ofBlock(t.getIntakeBlock(), t.getIntakeMeta()))) - .addElement('c', lazy(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta()))) - .addElement('g', lazy(t -> ofBlock(t.getGearboxBlock(), t.getGearboxMeta()))) - .addElement('d', lazy(t -> Dynamo.newAny(t.getCasingTextureIndex(), 2))) - .addElement('h', lazy(t -> - buildHatchAdder(GT_MetaTileEntity_DieselEngine.class) - .atLeast(InputHatch, InputHatch, InputHatch, Muffler, Maintenance) - .casingIndex(t.getCasingTextureIndex()) - .dot(1) - .buildAndChain(t.getCasingBlock(), t.getCasingMeta()) - )) - .build(); - } - }; + private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_DieselEngine>> STRUCTURE_DEFINITION = + new ClassValue<IStructureDefinition<GT_MetaTileEntity_DieselEngine>>() { + @Override + protected IStructureDefinition<GT_MetaTileEntity_DieselEngine> computeValue(Class<?> type) { + return StructureDefinition.<GT_MetaTileEntity_DieselEngine>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + { + "---", "iii", "chc", "chc", "ccc", + }, + { + "---", "i~i", "hgh", "hgh", "cdc", + }, + { + "---", "iii", "chc", "chc", "ccc", + }, + })) + .addElement('i', lazy(t -> ofBlock(t.getIntakeBlock(), t.getIntakeMeta()))) + .addElement('c', lazy(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta()))) + .addElement('g', lazy(t -> ofBlock(t.getGearboxBlock(), t.getGearboxMeta()))) + .addElement('d', lazy(t -> Dynamo.newAny(t.getCasingTextureIndex(), 2))) + .addElement('h', lazy(t -> buildHatchAdder(GT_MetaTileEntity_DieselEngine.class) + .atLeast(InputHatch, InputHatch, InputHatch, Muffler, Maintenance) + .casingIndex(t.getCasingTextureIndex()) + .dot(1) + .buildAndChain(t.getCasingBlock(), t.getCasingMeta()))) + .build(); + } + }; protected int fuelConsumption = 0; protected int fuelValue = 0; protected int fuelRemaining = 0; @@ -112,18 +116,41 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { - if (aActive) return new ITexture[]{ - casingTexturePages[0][50], - TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + if (aActive) + return new ITexture[] { casingTexturePages[0][50], - TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + casingTexturePages[0][50], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DIESEL_ENGINE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DIESEL_ENGINE_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{casingTexturePages[0][50]}; + return new ITexture[] {casingTexturePages[0][50]}; } @Override @@ -133,7 +160,8 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png"); } // can't use getRecipeMap() or else the fluid hatch will reject oxygen @@ -187,20 +215,25 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu if (tRecipe == null) continue; FluidStack tLiquid = tFluid.copy(); - fuelConsumption = tLiquid.amount = boostEu ? (getBoostFactor() * getNominalOutput() / tRecipe.mSpecialValue) : (getNominalOutput() / tRecipe.mSpecialValue); //Calc fuel consumption - //Deplete that amount + fuelConsumption = tLiquid.amount = boostEu + ? (getBoostFactor() * getNominalOutput() / tRecipe.mSpecialValue) + : (getNominalOutput() / tRecipe.mSpecialValue); // Calc fuel consumption + // Deplete that amount if (!depleteInput(tLiquid)) return false; boostEu = depleteInput(getBooster().getGas(2L * getAdditiveFactor())); - //Deplete Lubricant. 1000L should = 1 hour of runtime (if baseEU = 2048) - if ((mRuntime % 72 == 0 || mRuntime == 0) && !depleteInput(Materials.Lubricant.getFluid((boostEu ? 2L : 1L) * getAdditiveFactor()))) + // Deplete Lubricant. 1000L should = 1 hour of runtime (if baseEU = 2048) + if ((mRuntime % 72 == 0 || mRuntime == 0) + && !depleteInput(Materials.Lubricant.getFluid((boostEu ? 2L : 1L) * getAdditiveFactor()))) return false; fuelValue = tRecipe.mSpecialValue; - //Check to prevent burning HOG without consuming it, if not boosted - if (!boostEu && fuelValue > getNominalOutput()) { return false; } - fuelRemaining = tFluid.amount; //Record available fuel - this.mEUt = mEfficiency < 2000 ? 0 : getNominalOutput(); //Output 0 if startup is less than 20% + // Check to prevent burning HOG without consuming it, if not boosted + if (!boostEu && fuelValue > getNominalOutput()) { + return false; + } + fuelRemaining = tFluid.amount; // Record available fuel + this.mEUt = mEfficiency < 2000 ? 0 : getNominalOutput(); // Output 0 if startup is less than 20% this.mProgresstime = 1; this.mMaxProgresstime = 1; this.mEfficiencyIncrease = getEfficiencyIncrease(); @@ -212,7 +245,6 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu return false; } - @Override public IStructureDefinition<GT_MetaTileEntity_DieselEngine> getStructureDefinition() { return STRUCTURE_DEFINITION.get(getClass()); @@ -220,7 +252,9 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 1) && !mMufflerHatches.isEmpty() && mMaintenanceHatches.size() == 1; + return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 1) + && !mMufflerHatches.isEmpty() + && mMaintenanceHatches.size() == 1; } public Block getCasingBlock() { @@ -252,7 +286,10 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu } private boolean addToMachineList(IGregTechTileEntity tTileEntity) { - return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex()))); + return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) + || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) + || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) + || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex()))); } @Override @@ -292,44 +329,47 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu @Override public String[] getInfoData() { - int mPollutionReduction=0; + int mPollutionReduction = 0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { if (isValidMetaTileEntity(tHatch)) { - mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction); + mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction); } } - long storedEnergy=0; - long maxEnergy=0; - for(GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + long storedEnergy = 0; + long maxEnergy = 0; + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { if (isValidMetaTileEntity(tHatch)) { - storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } } - - return new String[]{ - EnumChatFormatting.BLUE + "Diesel Engine" + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", - getIdealStatus() == getRepairStatus() ? - EnumChatFormatting.GREEN + StatCollector.translateToLocal("GT5U.turbine.maintenance.false") + EnumChatFormatting.RESET : - EnumChatFormatting.RED + StatCollector.translateToLocal("GT5U.turbine.maintenance.true") + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.engine.output") + ": " + - EnumChatFormatting.RED + GT_Utility.formatNumbers((mEUt*mEfficiency/10000)) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.engine.consumption") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(fuelConsumption) + EnumChatFormatting.RESET + " L/t", - StatCollector.translateToLocal("GT5U.engine.value") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(fuelValue) + EnumChatFormatting.RESET + " EU/L", - StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " + - EnumChatFormatting.GOLD + GT_Utility.formatNumbers(fuelRemaining) + EnumChatFormatting.RESET + " L", - StatCollector.translateToLocal("GT5U.engine.efficiency") + ": " + - EnumChatFormatting.YELLOW + (mEfficiency/100F) + EnumChatFormatting.YELLOW + " %", - StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + - EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %" - + return new String[] { + EnumChatFormatting.BLUE + "Diesel Engine" + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + getIdealStatus() == getRepairStatus() + ? EnumChatFormatting.GREEN + + StatCollector.translateToLocal("GT5U.turbine.maintenance.false") + + EnumChatFormatting.RESET + : EnumChatFormatting.RED + + StatCollector.translateToLocal("GT5U.turbine.maintenance.true") + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.engine.output") + ": " + EnumChatFormatting.RED + + GT_Utility.formatNumbers((mEUt * mEfficiency / 10000)) + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.engine.consumption") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(fuelConsumption) + EnumChatFormatting.RESET + " L/t", + StatCollector.translateToLocal("GT5U.engine.value") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(fuelValue) + EnumChatFormatting.RESET + " EU/L", + StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " + EnumChatFormatting.GOLD + + GT_Utility.formatNumbers(fuelRemaining) + EnumChatFormatting.RESET + " L", + StatCollector.translateToLocal("GT5U.engine.efficiency") + ": " + EnumChatFormatting.YELLOW + + (mEfficiency / 100F) + EnumChatFormatting.YELLOW + " %", + StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + + mPollutionReduction + EnumChatFormatting.RESET + " %" }; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java index 867ffa6d02..6b00d693c5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java @@ -1,5 +1,18 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.isAir; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_GLOW; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; + import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; @@ -19,28 +32,16 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.List; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.isAir; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_GLOW; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_DistillationTower> implements ISurvivalConstructable { +public class GT_MetaTileEntity_DistillationTower + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_DistillationTower> + implements ISurvivalConstructable { protected static final int CASING_INDEX = 49; protected static final String STRUCTURE_PIECE_BASE = "base"; protected static final String STRUCTURE_PIECE_LAYER = "layer"; @@ -49,48 +50,65 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan private static final IStructureDefinition<GT_MetaTileEntity_DistillationTower> STRUCTURE_DEFINITION; static { - IHatchElement<GT_MetaTileEntity_DistillationTower> layeredOutputHatch = OutputHatch - .withCount(GT_MetaTileEntity_DistillationTower::getCurrentLayerOutputHatchCount) - .withAdder(GT_MetaTileEntity_DistillationTower::addLayerOutputHatch); + IHatchElement<GT_MetaTileEntity_DistillationTower> layeredOutputHatch = OutputHatch.withCount( + GT_MetaTileEntity_DistillationTower::getCurrentLayerOutputHatchCount) + .withAdder(GT_MetaTileEntity_DistillationTower::addLayerOutputHatch); STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_DistillationTower>builder() - .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][]{ - {"b~b", "bbb", "bbb"}, - })) - .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][]{ - {"lll", "lcl", "lll"} - })) - .addShape(STRUCTURE_PIECE_LAYER_HINT, transpose(new String[][]{ - {"lll", "l-l", "lll"} - })) - .addShape(STRUCTURE_PIECE_TOP_HINT, transpose(new String[][]{ - {"lll", "lll", "lll"} - })) - .addElement('b', ofChain( - buildHatchAdder(GT_MetaTileEntity_DistillationTower.class) - .atLeast(Energy, OutputBus, InputHatch, InputBus, Maintenance) - .casingIndex(CASING_INDEX) - .dot(1) - .build(), - onElementPass(GT_MetaTileEntity_DistillationTower::onCasingFound, ofBlock(GregTech_API.sBlockCasings4, 1)) - )) - .addElement('l', ofChain( - buildHatchAdder(GT_MetaTileEntity_DistillationTower.class) - .atLeast(layeredOutputHatch) - .casingIndex(CASING_INDEX) - .dot(2) - .build(), - ofHatchAdder(GT_MetaTileEntity_DistillationTower::addEnergyInputToMachineList, CASING_INDEX, 2), - ofHatchAdder(GT_MetaTileEntity_DistillationTower::addLayerOutputHatch, CASING_INDEX, 2), - ofHatchAdder(GT_MetaTileEntity_DistillationTower::addMaintenanceToMachineList, CASING_INDEX, 2), - onElementPass(GT_MetaTileEntity_DistillationTower::onCasingFound, ofBlock(GregTech_API.sBlockCasings4, 1)) - )) - .addElement('c', ofChain( - onElementPass(t -> t.onTopLayerFound(false), ofHatchAdder(GT_MetaTileEntity_DistillationTower::addOutputToMachineList, CASING_INDEX, 3)), - onElementPass(t -> t.onTopLayerFound(false), ofHatchAdder(GT_MetaTileEntity_DistillationTower::addMaintenanceToMachineList, CASING_INDEX, 3)), - onElementPass(t -> t.onTopLayerFound(true), ofBlock(GregTech_API.sBlockCasings4, 1)), - isAir() - )) - .build(); + .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][] { + {"b~b", "bbb", "bbb"}, + })) + .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][] {{"lll", "lcl", "lll"}})) + .addShape(STRUCTURE_PIECE_LAYER_HINT, transpose(new String[][] {{"lll", "l-l", "lll"}})) + .addShape(STRUCTURE_PIECE_TOP_HINT, transpose(new String[][] {{"lll", "lll", "lll"}})) + .addElement( + 'b', + ofChain( + buildHatchAdder(GT_MetaTileEntity_DistillationTower.class) + .atLeast(Energy, OutputBus, InputHatch, InputBus, Maintenance) + .casingIndex(CASING_INDEX) + .dot(1) + .build(), + onElementPass( + GT_MetaTileEntity_DistillationTower::onCasingFound, + ofBlock(GregTech_API.sBlockCasings4, 1)))) + .addElement( + 'l', + ofChain( + buildHatchAdder(GT_MetaTileEntity_DistillationTower.class) + .atLeast(layeredOutputHatch) + .casingIndex(CASING_INDEX) + .dot(2) + .build(), + ofHatchAdder( + GT_MetaTileEntity_DistillationTower::addEnergyInputToMachineList, + CASING_INDEX, + 2), + ofHatchAdder(GT_MetaTileEntity_DistillationTower::addLayerOutputHatch, CASING_INDEX, 2), + ofHatchAdder( + GT_MetaTileEntity_DistillationTower::addMaintenanceToMachineList, + CASING_INDEX, + 2), + onElementPass( + GT_MetaTileEntity_DistillationTower::onCasingFound, + ofBlock(GregTech_API.sBlockCasings4, 1)))) + .addElement( + 'c', + ofChain( + onElementPass( + t -> t.onTopLayerFound(false), + ofHatchAdder( + GT_MetaTileEntity_DistillationTower::addOutputToMachineList, + CASING_INDEX, + 3)), + onElementPass( + t -> t.onTopLayerFound(false), + ofHatchAdder( + GT_MetaTileEntity_DistillationTower::addMaintenanceToMachineList, + CASING_INDEX, + 3)), + onElementPass(t -> t.onTopLayerFound(true), ofBlock(GregTech_API.sBlockCasings4, 1)), + isAir())) + .build(); } protected final List<List<GT_MetaTileEntity_Hatch_Output>> mOutputHatchesByLayer = new ArrayList<>(); @@ -115,41 +133,64 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Distillery") - .addInfo("Controller block for the Distillation Tower") - .addInfo("Fluids are only put out at the correct height") - .addInfo("The correct height equals the slot number in the NEI recipe") - .addSeparator() - .beginVariableStructureBlock(3, 3, 3, 12, 3, 3, true) - .addController("Front bottom") - .addOtherStructurePart("Clean Stainless Steel Machine Casing", "7 x h - 5 (minimum)") - .addEnergyHatch("Any casing", 1, 2) - .addMaintenanceHatch("Any casing", 1, 2, 3) - .addInputHatch("Any bottom layer casing", 1) - .addOutputBus("Any bottom layer casing", 1) - .addOutputHatch("2-11x Output Hatches (At least one per layer except bottom layer)", 2, 3) - .toolTipFinisher("Gregtech"); + .addInfo("Controller block for the Distillation Tower") + .addInfo("Fluids are only put out at the correct height") + .addInfo("The correct height equals the slot number in the NEI recipe") + .addSeparator() + .beginVariableStructureBlock(3, 3, 3, 12, 3, 3, true) + .addController("Front bottom") + .addOtherStructurePart("Clean Stainless Steel Machine Casing", "7 x h - 5 (minimum)") + .addEnergyHatch("Any casing", 1, 2) + .addMaintenanceHatch("Any casing", 1, 2, 3) + .addInputHatch("Any bottom layer casing", 1) + .addOutputBus("Any bottom layer casing", 1) + .addOutputHatch("2-11x Output Hatches (At least one per layer except bottom layer)", 2, 3) + .toolTipFinisher("Gregtech"); return tt; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { if (aActive) - return new ITexture[]{ + return new ITexture[] { BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_INDEX)}; + return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_INDEX)}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png"); } @Override @@ -203,20 +244,24 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); if (tFluids.length > 0) { for (FluidStack tFluid : tFluids) { - tRecipe = GT_Recipe.GT_Recipe_Map.sDistillationRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluid}, inputs); + tRecipe = GT_Recipe.GT_Recipe_Map.sDistillationRecipes.findRecipe( + getBaseMetaTileEntity(), + false, + gregtech.api.enums.GT_Values.V[tTier], + new FluidStack[] {tFluid}, + inputs); if (tRecipe != null) { if (tRecipe.isRecipeInputEqual(true, tFluids, inputs)) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; + // In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; if (this.mEUt > 0) { this.mEUt = (-this.mEUt); } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.mOutputItems = new ItemStack[] {tRecipe.getOutput(0)}; this.mOutputFluids = tRecipe.mFluidOutputs.clone(); updateSlots(); return true; @@ -234,19 +279,20 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan protected void onTopLayerFound(boolean aIsCasing) { mTopLayerFound = true; - if (aIsCasing) - onCasingFound(); + if (aIsCasing) onCasingFound(); } protected int getCurrentLayerOutputHatchCount() { - return mOutputHatchesByLayer.size() < mHeight ? 0 : mOutputHatchesByLayer.get(mHeight - 1).size(); + return mOutputHatchesByLayer.size() < mHeight + ? 0 + : mOutputHatchesByLayer.get(mHeight - 1).size(); } protected boolean addLayerOutputHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null || aTileEntity.isDead() || !(aTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Output)) - return false; - while (mOutputHatchesByLayer.size() < mHeight) - mOutputHatchesByLayer.add(new ArrayList<>()); + if (aTileEntity == null + || aTileEntity.isDead() + || !(aTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Output)) return false; + while (mOutputHatchesByLayer.size() < mHeight) mOutputHatchesByLayer.add(new ArrayList<>()); GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aTileEntity.getMetaTileEntity(); tHatch.updateTexture(aBaseCasingIndex); return mOutputHatchesByLayer.get(mHeight - 1).add(tHatch); @@ -272,15 +318,15 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan mCasing = 0; // check base - if (!checkPiece(STRUCTURE_PIECE_BASE, 1, 0, 0)) - return false; + if (!checkPiece(STRUCTURE_PIECE_BASE, 1, 0, 0)) return false; // check each layer while (mHeight < 12) { if (!checkPiece(STRUCTURE_PIECE_LAYER, 1, mHeight, 0)) { return false; } - if (mOutputHatchesByLayer.size() < mHeight || mOutputHatchesByLayer.get(mHeight - 1).isEmpty()) + if (mOutputHatchesByLayer.size() < mHeight + || mOutputHatchesByLayer.get(mHeight - 1).isEmpty()) // layer without output hatch return false; if (mTopLayerFound) { @@ -332,15 +378,18 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) { if (mMachine) return -1; mHeight = 0; - int built = survivialBuildPiece(STRUCTURE_PIECE_BASE, stackSize, 1, 0, 0, elementBudget, source, actor, false, true); + int built = survivialBuildPiece( + STRUCTURE_PIECE_BASE, stackSize, 1, 0, 0, elementBudget, source, actor, false, true); if (built >= 0) return built; int tTotalHeight = Math.min(12, stackSize.stackSize + 2); // min 2 output layer, so at least 1 + 2 height for (int i = 1; i < tTotalHeight - 1; i++) { mHeight = i; - built = survivialBuildPiece(STRUCTURE_PIECE_LAYER_HINT, stackSize, 1, i, 0, elementBudget, source, actor, false, true); + built = survivialBuildPiece( + STRUCTURE_PIECE_LAYER_HINT, stackSize, 1, i, 0, elementBudget, source, actor, false, true); if (built >= 0) return built; } mHeight = tTotalHeight; - return survivialBuildPiece(STRUCTURE_PIECE_TOP_HINT, stackSize, 1, tTotalHeight - 1, 0, elementBudget, source, actor, false, true); + return survivialBuildPiece( + STRUCTURE_PIECE_TOP_HINT, stackSize, 1, tTotalHeight - 1, 0, elementBudget, source, actor, false, true); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java index b98b1f7b81..0ec74e3a78 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java @@ -1,5 +1,20 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.GT_HatchElement.Muffler; +import static gregtech.api.enums.GT_HatchElement.OutputBus; +import static gregtech.api.enums.GT_Values.W; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.getCasingTextureForId; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofFrame; + import com.google.common.collect.ImmutableList; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; @@ -18,9 +33,11 @@ import gregtech.api.metatileentity.implementations.*; import gregtech.api.objects.GT_ChunkManager; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_StructureUtility; import gregtech.api.util.GT_Utility; import gregtech.api.util.IGT_HatchAdder; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -32,59 +49,44 @@ import net.minecraft.world.ChunkCoordIntPair; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.GT_HatchElement.Muffler; -import static gregtech.api.enums.GT_HatchElement.OutputBus; -import static gregtech.api.enums.GT_Values.W; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.getCasingTextureForId; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofFrame; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_DrillerBase> implements IChunkLoader, ISurvivalConstructable { +public abstract class GT_MetaTileEntity_DrillerBase + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_DrillerBase> + implements IChunkLoader, ISurvivalConstructable { private static final ItemStack miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0); private static final ItemStack miningPipeTip = GT_ModHandler.getIC2Item("miningPipeTip", 0); private static final Block miningPipeBlock = GT_Utility.getBlockFromStack(miningPipe); private static final Block miningPipeTipBlock = GT_Utility.getBlockFromStack(miningPipeTip); protected static final String STRUCTURE_PIECE_MAIN = "main"; - protected static final ClassValue<IStructureDefinition<GT_MetaTileEntity_DrillerBase>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_DrillerBase>>() { - @Override - protected IStructureDefinition<GT_MetaTileEntity_DrillerBase> computeValue(Class<?> type) { - return StructureDefinition.<GT_MetaTileEntity_DrillerBase>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {" ", " f ", " "}, - {" ", " f ", " "}, - {" ", " f ", " "}, - {" f ", "fcf", " f "}, - {" f ", "fcf", " f "}, - {" f ", "fcf", " f "}, - {"b~b", "bbb", "bbb"}, - })) - .addElement('f', lazy(t -> ofFrame(t.getFrameMaterial()))) - .addElement('c', lazy(t -> ofBlock(t.getCasingBlockItem().getBlock(), t.getCasingBlockItem().get(0).getItemDamage()))) - .addElement('b', lazy(t -> buildHatchAdder(GT_MetaTileEntity_DrillerBase.class) - .atLeastList(t.getAllowedHatches()) - .casingIndex(t.casingTextureIndex) - .dot(1) - .buildAndChain( - t.getCasingBlockItem().getBlock(), t.getCasingBlockItem().get(0).getItemDamage() - ) - )) - .build(); - } - }; + protected static final ClassValue<IStructureDefinition<GT_MetaTileEntity_DrillerBase>> STRUCTURE_DEFINITION = + new ClassValue<IStructureDefinition<GT_MetaTileEntity_DrillerBase>>() { + @Override + protected IStructureDefinition<GT_MetaTileEntity_DrillerBase> computeValue(Class<?> type) { + return StructureDefinition.<GT_MetaTileEntity_DrillerBase>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {" ", " f ", " "}, + {" ", " f ", " "}, + {" ", " f ", " "}, + {" f ", "fcf", " f "}, + {" f ", "fcf", " f "}, + {" f ", "fcf", " f "}, + {"b~b", "bbb", "bbb"}, + })) + .addElement('f', lazy(t -> ofFrame(t.getFrameMaterial()))) + .addElement( + 'c', + lazy(t -> ofBlock( + t.getCasingBlockItem().getBlock(), + t.getCasingBlockItem().get(0).getItemDamage()))) + .addElement('b', lazy(t -> buildHatchAdder(GT_MetaTileEntity_DrillerBase.class) + .atLeastList(t.getAllowedHatches()) + .casingIndex(t.casingTextureIndex) + .dot(1) + .buildAndChain( + t.getCasingBlockItem().getBlock(), + t.getCasingBlockItem().get(0).getItemDamage()))) + .build(); + } + }; private Block casingBlock; private int casingMeta; @@ -95,8 +97,15 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En private ForgeDirection back; private int xDrill, yDrill, zDrill, xPipe, zPipe, yHead; - protected int getXDrill() { return xDrill; } - protected int getZDrill() { return zDrill; } + + protected int getXDrill() { + return xDrill; + } + + protected int getZDrill() { + return zDrill; + } + protected int workState; protected static final int STATE_DOWNWARD = 0, STATE_AT_BOTTOM = 1, STATE_UPWARD = 2; @@ -118,24 +127,49 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En casingBlock = getCasingBlockItem().getBlock(); casingMeta = getCasingBlockItem().get(0).getItemDamage(); int frameId = 4096 + getFrameMaterial().mMetaItemSubID; - frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W; + frameMeta = GregTech_API.METATILEENTITIES[frameId] != null + ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() + : W; casingTextureIndex = getCasingTextureIndex(); workState = STATE_DOWNWARD; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { - if (aActive) return new ITexture[]{ + if (aActive) + return new ITexture[] { getCasingTextureForId(casingTextureIndex), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ - getCasingTextureForId(casingTextureIndex), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ORE_DRILL_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ORE_DRILL_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + getCasingTextureForId(casingTextureIndex), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ORE_DRILL) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ORE_DRILL_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{getCasingTextureForId(casingTextureIndex)}; + return new ITexture[] {getCasingTextureForId(casingTextureIndex)}; } @Override @@ -156,18 +190,23 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En workState = aNBT.getInteger("workState"); if (aNBT.hasKey("isPickingPipes")) workState = aNBT.getBoolean("isPickingPipes") ? STATE_UPWARD : STATE_DOWNWARD; - if (aNBT.hasKey("chunkLoadingEnabled")) - mChunkLoadingEnabled = aNBT.getBoolean("chunkLoadingEnabled"); + if (aNBT.hasKey("chunkLoadingEnabled")) mChunkLoadingEnabled = aNBT.getBoolean("chunkLoadingEnabled"); if (aNBT.getBoolean("isChunkloading")) { - mCurrentChunk = new ChunkCoordIntPair(aNBT.getInteger("loadedChunkXPos"), aNBT.getInteger("loadedChunkZPos")); + mCurrentChunk = + new ChunkCoordIntPair(aNBT.getInteger("loadedChunkXPos"), aNBT.getInteger("loadedChunkZPos")); } } @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 (aSide == getBaseMetaTileEntity().getFrontFacing()) { mChunkLoadingEnabled = !mChunkLoadingEnabled; - GT_Utility.sendChatToPlayer(aPlayer, mChunkLoadingEnabled ? GT_Utility.trans("502", "Mining chunk loading enabled") : GT_Utility.trans("503", "Mining chunk loading disabled")); + GT_Utility.sendChatToPlayer( + aPlayer, + mChunkLoadingEnabled + ? GT_Utility.trans("502", "Mining chunk loading enabled") + : GT_Utility.trans("503", "Mining chunk loading disabled")); return true; } return super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); @@ -175,25 +214,26 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En @Override public void onRemoval() { - if (mChunkLoadingEnabled) - GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity()); + if (mChunkLoadingEnabled) GT_ChunkManager.releaseTicket((TileEntity) getBaseMetaTileEntity()); super.onRemoval(); } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide() && mCurrentChunk != null && !mWorkChunkNeedsReload && !aBaseMetaTileEntity.isAllowedToWork()) { + if (aBaseMetaTileEntity.isServerSide() + && mCurrentChunk != null + && !mWorkChunkNeedsReload + && !aBaseMetaTileEntity.isAllowedToWork()) { // if machine has stopped, stop chunkloading - GT_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity); + GT_ChunkManager.releaseTicket((TileEntity) aBaseMetaTileEntity); mWorkChunkNeedsReload = true; } } protected boolean tryPickPipe() { - if (yHead == yDrill) - return isPickingPipes = false; - if (tryOutputPipe()){ + if (yHead == yDrill) return isPickingPipes = false; + if (tryOutputPipe()) { if (checkBlockAndMeta(xPipe, yHead + 1, zPipe, miningPipeBlock, W)) getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead + 1, zPipe, miningPipeTipBlock); getBaseMetaTileEntity().getWorld().setBlockToAir(xPipe, yHead, zPipe); @@ -212,7 +252,6 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En return tryLowerPipeState(false) == 0; } - /** * @return 0 for succeeded, 1 for invalid block, 2 for not having mining pipes, 3 for event canceled. */ @@ -226,16 +265,24 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En protected int tryLowerPipeState(boolean isSimulating) { if (!isHasMiningPipes()) return 2; switch (canLowerPipe()) { - case 1: return 1; - case 2: return 3; + case 1: + return 1; + case 2: + return 3; } Block b = getBaseMetaTileEntity().getBlock(xPipe, yHead - 1, zPipe); - if (b != miningPipeTipBlock && !GT_Utility.setBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), xPipe, yHead - 1, zPipe, miningPipeTipBlock, 0, isSimulating)) - return 3; + if (b != miningPipeTipBlock + && !GT_Utility.setBlockByFakePlayer( + getFakePlayer(getBaseMetaTileEntity()), + xPipe, + yHead - 1, + zPipe, + miningPipeTipBlock, + 0, + isSimulating)) return 3; if (!isSimulating) { - if (yHead != yDrill) - getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead, zPipe, miningPipeBlock); + if (yHead != yDrill) getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead, zPipe, miningPipeBlock); if (b != miningPipeBlock && b != miningPipeTipBlock) getBaseMetaTileEntity().decrStackSize(1, 1); } @@ -248,7 +295,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En if (isHasMiningPipes(maxPipes)) return; ItemStack pipes = getStackInSlot(1); - if(pipes != null && !pipes.isItemEqual(miningPipe)) return; + if (pipes != null && !pipes.isItemEqual(miningPipe)) return; for (ItemStack storedItem : getStoredInputs()) { if (!storedItem.isItemEqual(miningPipe)) continue; @@ -268,7 +315,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En updateSlots(); } - private boolean tryOutputPipe(){ + private boolean tryOutputPipe() { if (!getBaseMetaTileEntity().addStackToSlot(1, GT_Utility.copyAmount(1, miningPipe))) mOutputItems = new ItemStack[] {GT_Utility.copyAmount(1, miningPipe)}; return true; @@ -277,7 +324,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En /** * @return 0 for available, 1 for invalid block, 2 for event canceled. */ - protected int canLowerPipe(){ + protected int canLowerPipe() { IGregTechTileEntity aBaseTile = getBaseMetaTileEntity(); if (yHead > 0 && GT_Utility.getBlockHardnessAt(aBaseTile.getWorld(), xPipe, yHead - 1, zPipe) >= 0) { return GT_Utility.eraseBlockByFakePlayer(getFakePlayer(aBaseTile), xPipe, yHead - 1, zPipe, true) ? 0 : 2; @@ -303,7 +350,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En * @return if no pipes are present */ @Deprecated - protected boolean waitForPipes(){ + protected boolean waitForPipes() { return !isHasMiningPipes(); } @@ -316,23 +363,37 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En return false; } - protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { + protected boolean workingDownward( + ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { switch (tryLowerPipeState()) { - case 2: mMaxProgresstime = 0; return false; - case 3: workState = STATE_UPWARD; return true; - case 1: workState = STATE_AT_BOTTOM; return true; - default: return true; + case 2: + mMaxProgresstime = 0; + return false; + case 3: + workState = STATE_UPWARD; + return true; + case 1: + workState = STATE_AT_BOTTOM; + return true; + default: + return true; } } - protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { + protected boolean workingAtBottom( + ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { switch (tryLowerPipeState(true)) { - case 0: workState = STATE_DOWNWARD; return true; - default: workState = STATE_UPWARD; return true; + case 0: + workState = STATE_DOWNWARD; + return true; + default: + workState = STATE_UPWARD; + return true; } } - protected boolean workingUpward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { + protected boolean workingUpward( + ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { if (tryPickPipe()) { return true; } else { @@ -344,7 +405,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En @Override public boolean checkRecipe(ItemStack aStack) { - //Public pipe actions + // Public pipe actions setElectricityStats(); int oldYHead = yHead; if (!checkPipesAndSetYHead() || !isEnergyEnough()) { @@ -377,7 +438,10 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { updateCoordinates(); - return checkPiece(STRUCTURE_PIECE_MAIN, 1, 6, 0) && checkHatches() && GT_Utility.getTier(getMaxInputVoltage()) >= getMinTier() && mMaintenanceHatches.size() == 1; + return checkPiece(STRUCTURE_PIECE_MAIN, 1, 6, 0) + && checkHatches() + && GT_Utility.getTier(getMaxInputVoltage()) >= getMinTier() + && mMaintenanceHatches.size() == 1; } private void updateCoordinates() { @@ -391,10 +455,10 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En private boolean checkPipesAndSetYHead() { yHead = yDrill - 1; - while (checkBlockAndMeta(xPipe, yHead, zPipe, miningPipeBlock, W)) yHead--; //skip pipes - //is pipe tip OR is controller layer + while (checkBlockAndMeta(xPipe, yHead, zPipe, miningPipeBlock, W)) yHead--; // skip pipes + // is pipe tip OR is controller layer if (checkBlockAndMeta(xPipe, yHead, zPipe, miningPipeTipBlock, W) || ++yHead == yDrill) return true; - //pipe column is broken - try fix + // pipe column is broken - try fix getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead, zPipe, miningPipeTipBlock); return true; } @@ -403,7 +467,8 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En protected boolean checkCasingBlock(int xOff, int yOff, int zOff) { return checkBlockAndMetaOffset(xOff, yOff, zOff, casingBlock, casingMeta); } - //meta of frame is getTileEntityBaseType; frame should be checked using its drops (possible a high weight operation) + // meta of frame is getTileEntityBaseType; frame should be checked using its drops (possible a high weight + // operation) @Deprecated protected boolean checkFrameBlock(int xOff, int yOff, int zOff) { return checkBlockAndMetaOffset(xOff, yOff, zOff, GregTech_API.sBlockMachines, frameMeta); @@ -465,11 +530,10 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En protected abstract void setElectricityStats(); - public int getTotalConfigValue(){ + public int getTotalConfigValue() { int config = 0; ArrayList<ItemStack> tCircuitList = getDataItems(1); - for (ItemStack tCircuit : tCircuitList) - config += tCircuit.getItemDamage(); + for (ItemStack tCircuit : tCircuitList) config += tCircuit.getItemDamage(); return config; } @@ -478,7 +542,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En /** * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb */ - private boolean isCorrectDataItem(ItemStack aStack, int state){ + private boolean isCorrectDataItem(ItemStack aStack, int state) { if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true; if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true; return (state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true); @@ -516,7 +580,9 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En } @Override - public ChunkCoordIntPair getActiveChunk(){return mCurrentChunk;} + public ChunkCoordIntPair getActiveChunk() { + return mCurrentChunk; + } @Override public void construct(ItemStack stackSize, boolean hintsOnly) { @@ -530,7 +596,15 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En } protected List<IHatchElement<? super GT_MetaTileEntity_DrillerBase>> getAllowedHatches() { - return ImmutableList.of(InputHatch, OutputHatch, InputBus, OutputBus, Muffler, Maintenance, Energy, DataHatchElement.DataAccess); + return ImmutableList.of( + InputHatch, + OutputHatch, + InputBus, + OutputBus, + Muffler, + Maintenance, + Energy, + DataHatchElement.DataAccess); } private enum DataHatchElement implements IHatchElement<GT_MetaTileEntity_DrillerBase> { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java index 396bf78b34..a2d1dee4a1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java @@ -1,5 +1,13 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.VN; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofCoil; + import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -17,6 +25,7 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; @@ -26,49 +35,55 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.VN; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofCoil; - -public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_AbstractMultiFurnace<GT_MetaTileEntity_ElectricBlastFurnace> implements ISurvivalConstructable { +public class GT_MetaTileEntity_ElectricBlastFurnace + extends GT_MetaTileEntity_AbstractMultiFurnace<GT_MetaTileEntity_ElectricBlastFurnace> + implements ISurvivalConstructable { private int mHeatingCapacity = 0; private boolean isBussesSeparate = false; protected final ArrayList<GT_MetaTileEntity_Hatch_Output> mPollutionOutputHatches = new ArrayList<>(); - protected final FluidStack[] pollutionFluidStacks = {Materials.CarbonDioxide.getGas(1000), - Materials.CarbonMonoxide.getGas(1000), Materials.SulfurDioxide.getGas(1000)}; + protected final FluidStack[] pollutionFluidStacks = { + Materials.CarbonDioxide.getGas(1000), + Materials.CarbonMonoxide.getGas(1000), + Materials.SulfurDioxide.getGas(1000) + }; protected static final int CASING_INDEX = 11; protected static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GT_MetaTileEntity_ElectricBlastFurnace> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_ElectricBlastFurnace>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {"ttt", "tmt", "ttt"}, - {"CCC", "C-C", "CCC",}, - {"CCC", "C-C", "CCC",}, - {"b~b", "bbb", "bbb"} - })) - .addElement('t', - buildHatchAdder(GT_MetaTileEntity_ElectricBlastFurnace.class) - .atLeast(OutputHatch.withAdder(GT_MetaTileEntity_ElectricBlastFurnace::addOutputHatchToTopList).withCount(t -> t.mPollutionOutputHatches.size())) - .casingIndex(CASING_INDEX) - .dot(1) - .buildAndChain(GregTech_API.sBlockCasings1, CASING_INDEX) - ) - .addElement('m', Muffler.newAny(CASING_INDEX, 2)) - .addElement('C', ofCoil(GT_MetaTileEntity_ElectricBlastFurnace::setCoilLevel, GT_MetaTileEntity_ElectricBlastFurnace::getCoilLevel)) - .addElement('b', - buildHatchAdder(GT_MetaTileEntity_ElectricBlastFurnace.class) - .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Maintenance, Energy) - .casingIndex(CASING_INDEX) - .dot(1) - .buildAndChain(GregTech_API.sBlockCasings1, CASING_INDEX) - ) - .build(); + private static final IStructureDefinition<GT_MetaTileEntity_ElectricBlastFurnace> STRUCTURE_DEFINITION = + StructureDefinition.<GT_MetaTileEntity_ElectricBlastFurnace>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {"ttt", "tmt", "ttt"}, + { + "CCC", "C-C", "CCC", + }, + { + "CCC", "C-C", "CCC", + }, + {"b~b", "bbb", "bbb"} + })) + .addElement( + 't', + buildHatchAdder(GT_MetaTileEntity_ElectricBlastFurnace.class) + .atLeast(OutputHatch.withAdder( + GT_MetaTileEntity_ElectricBlastFurnace::addOutputHatchToTopList) + .withCount(t -> t.mPollutionOutputHatches.size())) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain(GregTech_API.sBlockCasings1, CASING_INDEX)) + .addElement('m', Muffler.newAny(CASING_INDEX, 2)) + .addElement( + 'C', + ofCoil( + GT_MetaTileEntity_ElectricBlastFurnace::setCoilLevel, + GT_MetaTileEntity_ElectricBlastFurnace::getCoilLevel)) + .addElement( + 'b', + buildHatchAdder(GT_MetaTileEntity_ElectricBlastFurnace.class) + .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Maintenance, Energy) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain(GregTech_API.sBlockCasings1, CASING_INDEX)) + .build(); public GT_MetaTileEntity_ElectricBlastFurnace(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -91,7 +106,8 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab .addInfo("You can use some fluids to reduce recipe time. Place the circuit in the Input Bus") .addInfo("Each 900K over the min. Heat required reduces power consumption by 5% (multiplicatively)") .addInfo("Each 1800K over the min. Heat required grants one perfect overclock") - .addInfo("For each perfect overclock the EBF will reduce recipe time 4 times (instead of 2) (100% efficiency)") + .addInfo( + "For each perfect overclock the EBF will reduce recipe time 4 times (instead of 2) (100% efficiency)") .addInfo("Additionally gives +100K for every tier past MV") .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() @@ -113,28 +129,51 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { if (aActive) - return new ITexture[]{ - casingTexturePages[0][CASING_INDEX], - TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + return new ITexture[] { casingTexturePages[0][CASING_INDEX], - TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + casingTexturePages[0][CASING_INDEX], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{casingTexturePages[0][CASING_INDEX]}; + return new ITexture[] {casingTexturePages[0][CASING_INDEX]}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ElectricBlastFurnace.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ElectricBlastFurnace.png"); } @Override - public int getPollutionPerSecond(ItemStack aStack){ + public int getPollutionPerSecond(ItemStack aStack) { return GT_Mod.gregtechproxy.mPollutionEBFPerSecond; } @@ -155,7 +194,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab @Override public boolean checkRecipe(ItemStack aStack) { - if(isBussesSeparate) { + if (isBussesSeparate) { FluidStack[] tFluids = getStoredFluids().toArray(new FluidStack[0]); for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { ArrayList<ItemStack> tInputs = new ArrayList<>(); @@ -177,32 +216,22 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab } else { return processRecipe(getCompactedInputs(), getCompactedFluids()); } - } + protected boolean processRecipe(ItemStack[] tItems, FluidStack[] tFluids) { - if (tItems.length <= 0) - return false; + if (tItems.length <= 0) return false; long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe( - getBaseMetaTileEntity(), - false, - V[tTier], - tFluids, - tItems - ); - - if (tRecipe == null) - return false; - if (this.mHeatingCapacity < tRecipe.mSpecialValue) - return false; - if (!tRecipe.isRecipeInputEqual(true, tFluids, tItems)) - return false; - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; + getBaseMetaTileEntity(), false, V[tTier], tFluids, tItems); + + if (tRecipe == null) return false; + if (this.mHeatingCapacity < tRecipe.mSpecialValue) return false; + if (!tRecipe.isRecipeInputEqual(true, tFluids, tItems)) return false; + // In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; @@ -214,18 +243,13 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab } if (tHeatCapacityDivTiers > 0) { this.mEUt = (int) (this.mEUt * (Math.pow(0.95, tHeatCapacityDivTiers))); - this.mMaxProgresstime >>= Math.min(tHeatCapacityDivTiers / 2, overclockCount);//extra free overclocking if possible - if (this.mMaxProgresstime < 1) - this.mMaxProgresstime = 1;//no eu efficiency correction + this.mMaxProgresstime >>= + Math.min(tHeatCapacityDivTiers / 2, overclockCount); // extra free overclocking if possible + if (this.mMaxProgresstime < 1) this.mMaxProgresstime = 1; // no eu efficiency correction } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{ - tRecipe.getOutput(0), - tRecipe.getOutput(1) - }; - this.mOutputFluids = new FluidStack[]{ - tRecipe.getFluidOutput(0) - }; + this.mOutputItems = new ItemStack[] {tRecipe.getOutput(0), tRecipe.getOutput(1)}; + this.mOutputFluids = new FluidStack[] {tRecipe.getFluidOutput(0)}; updateSlots(); return true; } @@ -238,30 +262,32 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab protected byte calculateOverclockednessEBF(int aEUt, int aDuration, long maxInputVoltage) { byte mTier = (byte) Math.max(0, GT_Utility.getTier(maxInputVoltage)), timesOverclocked = 0; if (mTier == 0) { - //Long time calculation + // Long time calculation long xMaxProgresstime = ((long) aDuration) << 1; if (xMaxProgresstime > Integer.MAX_VALUE - 1) { - //make impossible if too long + // make impossible if too long mEUt = Integer.MAX_VALUE - 1; mMaxProgresstime = Integer.MAX_VALUE - 1; } else { mEUt = aEUt >> 2; mMaxProgresstime = (int) xMaxProgresstime; } - //return 0; + // return 0; } else { - //Long EUt calculation + // Long EUt calculation long xEUt = aEUt; - //Isnt too low EUt check? + // Isnt too low EUt check? long tempEUt = Math.max(xEUt, V[1]); mMaxProgresstime = aDuration; while (tempEUt <= V[mTier - 1]) { - tempEUt <<= 2;//this actually controls overclocking - //xEUt *= 4;//this is effect of everclocking - mMaxProgresstime >>= 1;//this is effect of overclocking - xEUt = mMaxProgresstime == 0 ? xEUt >> 1 : xEUt << 2;//U know, if the time is less than 1 tick make the machine use less power + tempEUt <<= 2; // this actually controls overclocking + // xEUt *= 4;//this is effect of everclocking + mMaxProgresstime >>= 1; // this is effect of overclocking + xEUt = mMaxProgresstime == 0 + ? xEUt >> 1 + : xEUt << 2; // U know, if the time is less than 1 tick make the machine use less power timesOverclocked++; } if (xEUt > Integer.MAX_VALUE - 1) { @@ -269,10 +295,8 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab mMaxProgresstime = Integer.MAX_VALUE - 1; } else { mEUt = (int) xEUt; - if (mEUt == 0) - mEUt = 1; - if (mMaxProgresstime == 0) - mMaxProgresstime = 1;//set time to 1 tick + if (mEUt == 0) mEUt = 1; + if (mMaxProgresstime == 0) mMaxProgresstime = 1; // set time to 1 tick } } return timesOverclocked; @@ -297,14 +321,11 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab mPollutionOutputHatches.clear(); - if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 3, 0)) - return false; + if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 3, 0)) return false; - if (getCoilLevel() == HeatingCoilLevel.None) - return false; + if (getCoilLevel() == HeatingCoilLevel.None) return false; - if (mMaintenanceHatches.size() != 1) - return false; + if (mMaintenanceHatches.size() != 1) return false; this.mHeatingCapacity = (int) getCoilLevel().getHeat() + 100 * (GT_Utility.getTier(getMaxInputVoltage()) - 2); return true; @@ -312,13 +333,11 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab @Override public boolean addOutput(FluidStack aLiquid) { - if (aLiquid == null) - return false; + if (aLiquid == null) return false; FluidStack tLiquid = aLiquid.copy(); boolean isOutputPollution = false; for (FluidStack pollutionFluidStack : pollutionFluidStacks) { - if (!tLiquid.isFluidEqual(pollutionFluidStack)) - continue; + if (!tLiquid.isFluidEqual(pollutionFluidStack)) continue; isOutputPollution = true; break; @@ -328,8 +347,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab tOutputHatches = this.mPollutionOutputHatches; int pollutionReduction = 0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (!isValidMetaTileEntity(tHatch)) - continue; + if (!isValidMetaTileEntity(tHatch)) continue; pollutionReduction = 100 - tHatch.calculatePollutionReduction(100); break; } @@ -337,55 +355,56 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab } else { tOutputHatches = this.mOutputHatches; } - return dumpFluid(tOutputHatches, tLiquid, true) || - dumpFluid(tOutputHatches, tLiquid, false); + return dumpFluid(tOutputHatches, tLiquid, true) || dumpFluid(tOutputHatches, tLiquid, false); } @Override public String[] getInfoData() { int mPollutionReduction = 0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (!isValidMetaTileEntity(tHatch)) - continue; + if (!isValidMetaTileEntity(tHatch)) continue; mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction); } long storedEnergy = 0; long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (!isValidMetaTileEntity(tHatch)) - continue; + if (!isValidMetaTileEntity(tHatch)) continue; storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } - return new String[]{ - StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", - StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " + - StatCollector.translateToLocal("GT5U.machines.tier") + ": " + - EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + - EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + - StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " + - EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - StatCollector.translateToLocal("GT5U.EBF.heat") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mHeatingCapacity) + EnumChatFormatting.RESET + " K", - StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + - EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %" + return new String[] { + StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " + + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + EnumChatFormatting.YELLOW + + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + EnumChatFormatting.YELLOW + + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + StatCollector.translateToLocal("GT5U.EBF.heat") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mHeatingCapacity) + EnumChatFormatting.RESET + " K", + StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + + mPollutionReduction + EnumChatFormatting.RESET + " %" }; } @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1,3,0); + buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1, 3, 0); } @Override @@ -397,7 +416,8 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { isBussesSeparate = !isBussesSeparate; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + isBussesSeparate); + GT_Utility.sendChatToPlayer( + aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + isBussesSeparate); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java index e618457d9a..5b9979dbb5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java @@ -1,5 +1,11 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; @@ -19,18 +25,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; - public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_DieselEngine { public GT_MetaTileEntity_ExtremeDieselEngine(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } - + public GT_MetaTileEntity_ExtremeDieselEngine(String aName) { super(aName); } @@ -69,23 +69,47 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { - if (aActive) return new ITexture[]{ + if (aActive) + return new ITexture[] { casingTexturePages[0][60], - TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ - casingTexturePages[0][60], - TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + casingTexturePages[0][60], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{casingTexturePages[0][60]}; + return new ITexture[] {casingTexturePages[0][60]}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeExtremeDieselEngine.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeExtremeDieselEngine.png"); } @Override @@ -134,7 +158,9 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die } @Override - protected int getBoostFactor() { return 2; } + protected int getBoostFactor() { + return 2; + } @Override protected Materials getBooster() { @@ -163,42 +189,47 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die @Override public String[] getInfoData() { - int mPollutionReduction=0; + int mPollutionReduction = 0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { if (isValidMetaTileEntity(tHatch)) { - mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction); + mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction); } } - long storedEnergy=0; - long maxEnergy=0; - for(GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + long storedEnergy = 0; + long maxEnergy = 0; + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { if (isValidMetaTileEntity(tHatch)) { - storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } } - - return new String[]{ - EnumChatFormatting.BLUE + "Extreme Diesel Engine" + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", - getIdealStatus() == getRepairStatus() ? - EnumChatFormatting.GREEN + StatCollector.translateToLocal("GT5U.turbine.maintenance.false") + EnumChatFormatting.RESET : - EnumChatFormatting.RED + StatCollector.translateToLocal("GT5U.turbine.maintenance.true") + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.engine.output") + ": " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(-mEUt*mEfficiency/10000) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.engine.consumption") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(fuelConsumption) + EnumChatFormatting.RESET + " L/t", - StatCollector.translateToLocal("GT5U.engine.value") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(fuelValue) + EnumChatFormatting.RESET + " EU/L", - StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " + - EnumChatFormatting.GOLD + GT_Utility.formatNumbers(fuelRemaining) + EnumChatFormatting.RESET + " L", - StatCollector.translateToLocal("GT5U.engine.efficiency") + ": " + - EnumChatFormatting.YELLOW + (mEfficiency/100F) + EnumChatFormatting.YELLOW + " %", - StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + - EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %" + + return new String[] { + EnumChatFormatting.BLUE + "Extreme Diesel Engine" + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + getIdealStatus() == getRepairStatus() + ? EnumChatFormatting.GREEN + + StatCollector.translateToLocal("GT5U.turbine.maintenance.false") + + EnumChatFormatting.RESET + : EnumChatFormatting.RED + + StatCollector.translateToLocal("GT5U.turbine.maintenance.true") + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.engine.output") + ": " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(-mEUt * mEfficiency / 10000) + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.engine.consumption") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(fuelConsumption) + EnumChatFormatting.RESET + " L/t", + StatCollector.translateToLocal("GT5U.engine.value") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(fuelValue) + EnumChatFormatting.RESET + " EU/L", + StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " + EnumChatFormatting.GOLD + + GT_Utility.formatNumbers(fuelRemaining) + EnumChatFormatting.RESET + " L", + StatCollector.translateToLocal("GT5U.engine.efficiency") + ": " + EnumChatFormatting.YELLOW + + (mEfficiency / 100F) + EnumChatFormatting.YELLOW + " %", + StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + + mPollutionReduction + EnumChatFormatting.RESET + " %" }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java index 30f8ff8746..4e708065bd 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java @@ -1,5 +1,17 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.Energy; +import static gregtech.api.enums.GT_HatchElement.InputHatch; +import static gregtech.api.enums.GT_HatchElement.OutputHatch; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.filterByMTETier; + import com.google.common.collect.ImmutableMap; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; @@ -20,6 +32,7 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_GUIContainer_FusionReactor; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; @@ -29,28 +42,17 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.InputHatch; -import static gregtech.api.enums.GT_HatchElement.OutputHatch; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.filterByMTETier; - -public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_FusionComputer> implements ISurvivalConstructable { +public abstract class GT_MetaTileEntity_FusionComputer + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_FusionComputer> + implements ISurvivalConstructable { public static final String STRUCTURE_PIECE_MAIN = "main"; - private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_FusionComputer>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_FusionComputer>>() { - @Override - protected IStructureDefinition<GT_MetaTileEntity_FusionComputer> computeValue(Class<?> type) { - return StructureDefinition.<GT_MetaTileEntity_FusionComputer>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - { + private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_FusionComputer>> STRUCTURE_DEFINITION = + new ClassValue<IStructureDefinition<GT_MetaTileEntity_FusionComputer>>() { + @Override + protected IStructureDefinition<GT_MetaTileEntity_FusionComputer> computeValue(Class<?> type) { + return StructureDefinition.<GT_MetaTileEntity_FusionComputer>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + { " ", " ihi ", " hh hh ", @@ -66,8 +68,8 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity " hh hh ", " ihi ", " ", - }, - { + }, + { " xhx ", " hhccchh ", " eccxhxcce ", @@ -83,8 +85,8 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity " eccx~xcce ", " hhccchh ", " xhx ", - }, - { + }, + { " ", " ihi ", " hh hh ", @@ -100,46 +102,49 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity " hh hh ", " ihi ", " ", - } - })) - .addElement('c', lazy(t -> ofBlock(t.getFusionCoil(), t.getFusionCoilMeta()))) - .addElement('h', lazy(t -> ofBlock(t.getCasing(), t.getCasingMeta()))) - .addElement('i', lazy(t -> - buildHatchAdder(GT_MetaTileEntity_FusionComputer.class) - .atLeast(ImmutableMap.of(InputHatch.withAdder(GT_MetaTileEntity_FusionComputer::addInjector), 2)) - .hatchItemFilterAnd(t2 -> filterByMTETier(t2.tier(), Integer.MAX_VALUE)) - .casingIndex(53) - .dot(1) - .buildAndChain(t.getCasing(), t.getCasingMeta())) - ) - .addElement('e', lazy(t -> - buildHatchAdder(GT_MetaTileEntity_FusionComputer.class) - .atLeast(ImmutableMap.of(Energy.withAdder(GT_MetaTileEntity_FusionComputer::addEnergyInjector), 16)) - .hatchItemFilterAnd(t2 -> filterByMTETier(t2.tier(), Integer.MAX_VALUE)) - .casingIndex(53) - .dot(2) - .buildAndChain(t.getCasing(), t.getCasingMeta()) - )) - .addElement('x', lazy(t -> - buildHatchAdder(GT_MetaTileEntity_FusionComputer.class) - .atLeast(OutputHatch.withAdder(GT_MetaTileEntity_FusionComputer::addExtractor)) - .hatchItemFilterAnd(t2 -> filterByMTETier(t2.tier(), Integer.MAX_VALUE)) - .casingIndex(53) - .dot(3) - .buildAndChain(t.getCasing(), t.getCasingMeta()) - )) - .build(); - } - }; + } + })) + .addElement('c', lazy(t -> ofBlock(t.getFusionCoil(), t.getFusionCoilMeta()))) + .addElement('h', lazy(t -> ofBlock(t.getCasing(), t.getCasingMeta()))) + .addElement('i', lazy(t -> buildHatchAdder(GT_MetaTileEntity_FusionComputer.class) + .atLeast(ImmutableMap.of( + InputHatch.withAdder(GT_MetaTileEntity_FusionComputer::addInjector), 2)) + .hatchItemFilterAnd(t2 -> filterByMTETier(t2.tier(), Integer.MAX_VALUE)) + .casingIndex(53) + .dot(1) + .buildAndChain(t.getCasing(), t.getCasingMeta()))) + .addElement('e', lazy(t -> buildHatchAdder(GT_MetaTileEntity_FusionComputer.class) + .atLeast(ImmutableMap.of( + Energy.withAdder(GT_MetaTileEntity_FusionComputer::addEnergyInjector), 16)) + .hatchItemFilterAnd(t2 -> filterByMTETier(t2.tier(), Integer.MAX_VALUE)) + .casingIndex(53) + .dot(2) + .buildAndChain(t.getCasing(), t.getCasingMeta()))) + .addElement('x', lazy(t -> buildHatchAdder(GT_MetaTileEntity_FusionComputer.class) + .atLeast(OutputHatch.withAdder(GT_MetaTileEntity_FusionComputer::addExtractor)) + .hatchItemFilterAnd(t2 -> filterByMTETier(t2.tier(), Integer.MAX_VALUE)) + .casingIndex(53) + .dot(3) + .buildAndChain(t.getCasing(), t.getCasingMeta()))) + .build(); + } + }; public GT_Recipe mLastRecipe; public long mEUStore; static { - Textures.BlockIcons.setCasingTextureForId(52, + Textures.BlockIcons.setCasingTextureForId( + 52, TextureFactory.of( - TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW).extFacing().build(), - TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).extFacing().glow().build() - )); + TextureFactory.builder() + .addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW) + .extFacing() + .glow() + .build())); } public GT_MetaTileEntity_FusionComputer(int aID, String aName, String aNameRegional, int tier) { @@ -162,7 +167,12 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_FusionReactor(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "FusionComputer.png", GT_Recipe.GT_Recipe_Map.sFusionRecipes.mNEIName); + return new GT_GUIContainer_FusionReactor( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "FusionComputer.png", + GT_Recipe.GT_Recipe_Map.sFusionRecipes.mNEIName); } @Override @@ -204,7 +214,10 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - if (checkPiece(STRUCTURE_PIECE_MAIN, 7, 1, 12) && mInputHatches.size() > 1 && !mOutputHatches.isEmpty() && !mEnergyHatches.isEmpty()) { + if (checkPiece(STRUCTURE_PIECE_MAIN, 7, 1, 12) + && mInputHatches.size() > 1 + && !mOutputHatches.isEmpty() + && !mEnergyHatches.isEmpty()) { mWrench = true; mScrewdriver = true; mSoftHammer = true; @@ -257,10 +270,28 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity public abstract int getFusionCoilMeta(); @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) return new ITexture[]{TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS).extFacing().build(), getTextureOverlay()}; - if (aActive) return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(52)}; - return new ITexture[]{TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS).extFacing().build()}; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + if (aSide == aFacing) + return new ITexture[] { + TextureFactory.builder() + .addIcon(MACHINE_CASING_FUSION_GLASS) + .extFacing() + .build(), + getTextureOverlay() + }; + if (aActive) return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(52)}; + return new ITexture[] { + TextureFactory.builder() + .addIcon(MACHINE_CASING_FUSION_GLASS) + .extFacing() + .build() + }; } /** @@ -281,22 +312,24 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity return mStartEnergy < 160000000 ? 2 : 1; } if (this.tierOverclock() == 4) { - return (mStartEnergy < 160000000 ? 4 : (mStartEnergy < 320000000 ? 2 : 1)); - } + return (mStartEnergy < 160000000 ? 4 : (mStartEnergy < 320000000 ? 2 : 1)); + } return (mStartEnergy < 160000000) ? 8 : ((mStartEnergy < 320000000) ? 4 : (mStartEnergy < 640000000) ? 2 : 1); } @Override public boolean checkRecipe(ItemStack aStack) { ArrayList<FluidStack> tFluidList = getStoredFluids(); - int tFluidList_sS=tFluidList.size(); + int tFluidList_sS = tFluidList.size(); for (int i = 0; i < tFluidList_sS - 1; i++) { for (int j = i + 1; j < tFluidList_sS; j++) { if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { - tFluidList.remove(j--); tFluidList_sS=tFluidList.size(); + tFluidList.remove(j--); + tFluidList_sS = tFluidList.size(); } else { - tFluidList.remove(i--); tFluidList_sS=tFluidList.size(); + tFluidList.remove(i--); + tFluidList_sS = tFluidList.size(); break; } } @@ -306,9 +339,11 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); GT_Recipe tRecipe; - tRecipe = GT_Recipe.GT_Recipe_Map.sFusionRecipes.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, GT_Values.V[tier()], tFluids); + tRecipe = GT_Recipe.GT_Recipe_Map.sFusionRecipes.findRecipe( + this.getBaseMetaTileEntity(), this.mLastRecipe, false, GT_Values.V[tier()], tFluids); if (tRecipe == null) { - tRecipe = GT_Recipe.GT_Recipe_Map.sComplexFusionRecipes.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, GT_Values.V[tier()], tFluids); + tRecipe = GT_Recipe.GT_Recipe_Map.sComplexFusionRecipes.findRecipe( + this.getBaseMetaTileEntity(), this.mLastRecipe, false, GT_Values.V[tier()], tFluids); } if ((tRecipe == null && !mRunningOnLoad) || (maxEUStore() < tRecipe.mSpecialValue)) { @@ -354,8 +389,7 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - if (mEfficiency < 0) - mEfficiency = 0; + if (mEfficiency < 0) mEfficiency = 0; if (mRunningOnLoad && checkMachine(aBaseMetaTileEntity, mInventory[1])) { this.mEUStore = aBaseMetaTileEntity.getStoredEU(); checkRecipe(); @@ -375,7 +409,8 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity if (isValidMetaTileEntity(tHatch)) { long energyToMove = GT_Values.V[tier()] / 16; if (aBaseMetaTileEntity.getStoredEU() + energyToMove < maxEUStore() - && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(energyToMove, false)) { + && tHatch.getBaseMetaTileEntity() + .decreaseStoredEnergyUnits(energyToMove, false)) { aBaseMetaTileEntity.increaseStoredEnergyUnits(energyToMove, true); } } @@ -390,23 +425,29 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity for (ItemStack tStack : mOutputItems) if (tStack != null) addOutput(tStack); if (mOutputFluids != null) for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack); - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]))); + mEfficiency = Math.max( + 0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]))); mOutputItems = null; mProgresstime = 0; mMaxProgresstime = 0; mEfficiencyIncrease = 0; if (mOutputFluids != null && mOutputFluids.length > 0) { try { - GT_Mod.achievements.issueAchivementHatchFluid(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), mOutputFluids[0]); + GT_Mod.achievements.issueAchivementHatchFluid( + aBaseMetaTileEntity + .getWorld() + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + mOutputFluids[0]); } catch (Exception ignored) { } } this.mEUStore = aBaseMetaTileEntity.getStoredEU(); - if (aBaseMetaTileEntity.isAllowedToWork()) - checkRecipe(); + if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(); } } else { - if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { + if (aTick % 100 == 0 + || aBaseMetaTileEntity.hasWorkJustBeenEnabled() + || aBaseMetaTileEntity.hasInventoryBeenModified()) { turnCasingActive(mMaxProgresstime > 0); if (aBaseMetaTileEntity.isAllowedToWork()) { this.mEUStore = aBaseMetaTileEntity.getStoredEU(); @@ -414,11 +455,11 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity if (this.mEUStore < this.mLastRecipe.mSpecialValue - this.mEUt) { criticalStopMachine(); } - aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue - this.mEUt, true); + aBaseMetaTileEntity.decreaseStoredEnergyUnits( + this.mLastRecipe.mSpecialValue - this.mEUt, true); } } - if (mMaxProgresstime <= 0) - mEfficiency = Math.max(0, mEfficiency - 1000); + if (mMaxProgresstime <= 0) mEfficiency = Math.max(0, mEfficiency - 1000); } } } else { @@ -426,7 +467,8 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity stopMachine(); } } - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mMachine ? 0 : 64)); + aBaseMetaTileEntity.setErrorDisplayID( + (aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mMachine ? 0 : 64)); aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); } } @@ -462,6 +504,7 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity public int getDamageToComponent(ItemStack aStack) { return 0; } + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return false; @@ -475,25 +518,31 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity @Override public String[] getInfoData() { - String tier = tier() == 6 ? EnumChatFormatting.RED+"I"+EnumChatFormatting.RESET : tier() == 7 ? EnumChatFormatting.YELLOW+"II"+EnumChatFormatting.RESET : tier() == 8 ? EnumChatFormatting.GRAY+"III"+EnumChatFormatting.RESET : "IV"; + String tier = tier() == 6 + ? EnumChatFormatting.RED + "I" + EnumChatFormatting.RESET + : tier() == 7 + ? EnumChatFormatting.YELLOW + "II" + EnumChatFormatting.RESET + : tier() == 8 ? EnumChatFormatting.GRAY + "III" + EnumChatFormatting.RESET : "IV"; float plasmaOut = 0; int powerRequired = 0; if (this.mLastRecipe != null) { powerRequired = this.mLastRecipe.mEUt; if (this.mLastRecipe.getFluidOutput(0) != null) { - plasmaOut = (float)this.mLastRecipe.getFluidOutput(0).amount / (float)this.mLastRecipe.mDuration; + plasmaOut = (float) this.mLastRecipe.getFluidOutput(0).amount / (float) this.mLastRecipe.mDuration; } } - return new String[]{ - EnumChatFormatting.BLUE + "Fusion Reactor MK " + EnumChatFormatting.RESET + tier, - StatCollector.translateToLocal("GT5U.fusion.req") + ": " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(powerRequired) + EnumChatFormatting.RESET + "EU/t", - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mEUStore) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEUStore()) + EnumChatFormatting.RESET + " EU", - StatCollector.translateToLocal("GT5U.fusion.plasma") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(plasmaOut) + EnumChatFormatting.RESET + "L/t"}; + return new String[] { + EnumChatFormatting.BLUE + "Fusion Reactor MK " + EnumChatFormatting.RESET + tier, + StatCollector.translateToLocal("GT5U.fusion.req") + ": " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(powerRequired) + EnumChatFormatting.RESET + "EU/t", + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mEUStore) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEUStore()) + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.fusion.plasma") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(plasmaOut) + EnumChatFormatting.RESET + "L/t" + }; } @Override @@ -509,6 +558,7 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity @Override public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) { if (mMachine) return -1; - return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 7, 1, 12, elementBudget, source, actor, false, true); + return survivialBuildPiece( + STRUCTURE_PIECE_MAIN, stackSize, 7, 1, 12, elementBudget, source, actor, false, true); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java index dd942d2635..ef218cb643 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1_GLOW; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -8,14 +11,15 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import net.minecraft.block.Block; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1_GLOW; - public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionComputer { private static final ITexture textureOverlay = TextureFactory.of( TextureFactory.builder().addIcon(OVERLAY_FUSION1).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FUSION1_GLOW).extFacing().glow().build()); + TextureFactory.builder() + .addIcon(OVERLAY_FUSION1_GLOW) + .extFacing() + .glow() + .build()); public GT_MetaTileEntity_FusionComputer1(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 6); @@ -92,5 +96,4 @@ public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionC public int tierOverclock() { return 1; } - } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java index 8d2b0b6d3b..a763e1f639 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2_GLOW; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -8,14 +11,15 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import net.minecraft.block.Block; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2_GLOW; - public class GT_MetaTileEntity_FusionComputer2 extends GT_MetaTileEntity_FusionComputer { private static final ITexture textureOverlay = TextureFactory.of( TextureFactory.builder().addIcon(OVERLAY_FUSION2).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FUSION2_GLOW).extFacing().glow().build()); + TextureFactory.builder() + .addIcon(OVERLAY_FUSION2_GLOW) + .extFacing() + .glow() + .build()); public GT_MetaTileEntity_FusionComputer2(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 6); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java index 67cb06f3c1..c2c0367d61 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION3; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION3_GLOW; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -8,14 +11,15 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import net.minecraft.block.Block; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION3; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION3_GLOW; - public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionComputer { private static final ITexture textureOverlay = TextureFactory.of( TextureFactory.builder().addIcon(OVERLAY_FUSION3).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FUSION3_GLOW).extFacing().glow().build()); + TextureFactory.builder() + .addIcon(OVERLAY_FUSION3_GLOW) + .extFacing() + .glow() + .build()); public GT_MetaTileEntity_FusionComputer3(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 6); @@ -93,4 +97,3 @@ public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionC return 4; } } - diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java index d006f6d961..d1614bccc5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java @@ -1,5 +1,12 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; + import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; @@ -29,48 +36,57 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; - -public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_HeatExchanger> implements ISurvivalConstructable { +public class GT_MetaTileEntity_HeatExchanger + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_HeatExchanger> + implements ISurvivalConstructable { private static final int CASING_INDEX = 50; private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GT_MetaTileEntity_HeatExchanger> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_HeatExchanger>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {"ccc", "cCc", "ccc"}, - {"ccc", "cPc", "ccc"}, - {"ccc", "cPc", "ccc"}, - {"c~c", "cHc", "ccc"}, - })) - .addElement('P', ofBlock(GregTech_API.sBlockCasings2, 14)) - .addElement('C', OutputHatch.withAdder(GT_MetaTileEntity_HeatExchanger::addColdFluidOutputToMachineList).withCount(t -> isValidMetaTileEntity(t.mOutputColdFluidHatch) ? 1 : 0).newAny(CASING_INDEX, 3)) - .addElement('H', OutputHatch.withAdder(GT_MetaTileEntity_HeatExchanger::addHotFluidInputToMachineList).withCount(t -> isValidMetaTileEntity(t.mInputHotFluidHatch) ? 1 : 0).newAny(CASING_INDEX, 3)) - .addElement('c', buildHatchAdder(GT_MetaTileEntity_HeatExchanger.class) - .atLeast(InputBus, InputHatch, OutputBus, OutputHatch, Maintenance) - .casingIndex(CASING_INDEX) - .dot(1) - .buildAndChain(onElementPass(GT_MetaTileEntity_HeatExchanger::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, (byte) 2)) - )) - .build(); - public static float penalty_per_config = 0.015f; // penalize 1.5% efficiency per circuitry level (1-25) + private static final IStructureDefinition<GT_MetaTileEntity_HeatExchanger> STRUCTURE_DEFINITION = + StructureDefinition.<GT_MetaTileEntity_HeatExchanger>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {"ccc", "cCc", "ccc"}, + {"ccc", "cPc", "ccc"}, + {"ccc", "cPc", "ccc"}, + {"c~c", "cHc", "ccc"}, + })) + .addElement('P', ofBlock(GregTech_API.sBlockCasings2, 14)) + .addElement( + 'C', + OutputHatch.withAdder(GT_MetaTileEntity_HeatExchanger::addColdFluidOutputToMachineList) + .withCount(t -> isValidMetaTileEntity(t.mOutputColdFluidHatch) ? 1 : 0) + .newAny(CASING_INDEX, 3)) + .addElement( + 'H', + OutputHatch.withAdder(GT_MetaTileEntity_HeatExchanger::addHotFluidInputToMachineList) + .withCount(t -> isValidMetaTileEntity(t.mInputHotFluidHatch) ? 1 : 0) + .newAny(CASING_INDEX, 3)) + .addElement( + 'c', + buildHatchAdder(GT_MetaTileEntity_HeatExchanger.class) + .atLeast(InputBus, InputHatch, OutputBus, OutputHatch, Maintenance) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain(onElementPass( + GT_MetaTileEntity_HeatExchanger::onCasingAdded, + ofBlock(GregTech_API.sBlockCasings4, (byte) 2)))) + .build(); + public static float penalty_per_config = 0.015f; // penalize 1.5% efficiency per circuitry level (1-25) private GT_MetaTileEntity_Hatch_Input mInputHotFluidHatch; private GT_MetaTileEntity_Hatch_Output mOutputColdFluidHatch; private boolean superheated = false; - private int superheated_threshold=0; + private int superheated_threshold = 0; /** * How much more steam we can make without draining real water. Unit is (1L/GT_Values.STEAM_PER_WATER) */ private int steamBudget; + private int mCasingAmount; public GT_MetaTileEntity_HeatExchanger(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } + public GT_MetaTileEntity_HeatExchanger(String aName) { super(aName); } @@ -114,24 +130,47 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { if (aActive) - return new ITexture[]{ - casingTexturePages[0][CASING_INDEX], - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + return new ITexture[] { casingTexturePages[0][CASING_INDEX], - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + casingTexturePages[0][CASING_INDEX], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{casingTexturePages[0][CASING_INDEX]}; + return new ITexture[] {casingTexturePages[0][CASING_INDEX]}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeHeatExchanger.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeHeatExchanger.png"); } @Override @@ -146,16 +185,15 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM @Override public boolean checkRecipe(ItemStack aStack) { - if (mInputHotFluidHatch.getFluid() == null) - return true; + if (mInputHotFluidHatch.getFluid() == null) return true; int fluidAmountToConsume = mInputHotFluidHatch.getFluidAmount(); // how much fluid is in hatch - superheated_threshold = 4000; // default: must have 4000L per second to generate superheated steam - float efficiency = 1f; // default: operate at 100% efficiency with no integrated circuitry + superheated_threshold = 4000; // default: must have 4000L per second to generate superheated steam + float efficiency = 1f; // default: operate at 100% efficiency with no integrated circuitry int shs_reduction_per_config = 150; // reduce threshold 150L/s per circuitry level (1-25) float steam_output_multiplier = 20f; // default: multiply output by 4 * 10 (boosted x5) - float penalty = 0.0f; // penalty to apply to output based on circuitry level (1-25). + float penalty = 0.0f; // penalty to apply to output based on circuitry level (1-25). boolean do_lava = false; // Do we have an integrated circuit with a valid configuration? @@ -176,15 +214,18 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM do_lava = true; } else if (mInputHotFluidHatch.getFluid().isFluidEqual(FluidRegistry.getFluidStack("ic2hotcoolant", 1))) { steam_output_multiplier /= 2f; // was boosted x2 on top of x5 -> total x10 -> nerf with this code back to 5x - superheated_threshold /=5f; // 10x smaller since the Hot Things production in reactor is the same. + superheated_threshold /= 5f; // 10x smaller since the Hot Things production in reactor is the same. } else { // If we're working with neither, fail out - superheated_threshold=0; + superheated_threshold = 0; return false; } - superheated = fluidAmountToConsume >= superheated_threshold; // set the internal superheated flag if we have enough hot fluid. Used in the onRunningTick method. - fluidAmountToConsume = Math.min(fluidAmountToConsume, superheated_threshold * 2); // Don't consume too much hot fluid per second + superheated = fluidAmountToConsume + >= superheated_threshold; // set the internal superheated flag if we have enough hot fluid. Used in the + // onRunningTick method. + fluidAmountToConsume = Math.min( + fluidAmountToConsume, superheated_threshold * 2); // Don't consume too much hot fluid per second mInputHotFluidHatch.drain(fluidAmountToConsume, true); this.mMaxProgresstime = 20; this.mEUt = (int) (fluidAmountToConsume * steam_output_multiplier * efficiency); @@ -208,24 +249,27 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM @Override public boolean onRunningTick(ItemStack aStack) { if (this.mEUt > 0) { - int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L); // APPROXIMATELY how much steam to generate. + int tGeneratedEU = + (int) (this.mEUt * 2L * this.mEfficiency / 10000L); // APPROXIMATELY how much steam to generate. if (tGeneratedEU > 0) { if (superheated) tGeneratedEU /= 2; // We produce half as much superheated steam if necessary int distilledConsumed = useWater(tGeneratedEU); // how much distilled water to consume - //tGeneratedEU = distilledConsumed * 160; // EXACTLY how much steam to generate, producing a perfect 1:160 ratio with distilled water consumption + // tGeneratedEU = distilledConsumed * 160; // EXACTLY how much steam to generate, producing a perfect + // 1:160 ratio with distilled water consumption FluidStack distilledStack = GT_ModHandler.getDistilledWater(distilledConsumed); if (depleteInput(distilledStack)) // Consume the distilled water { if (superheated) { - addOutput(FluidRegistry.getFluidStack("ic2superheatedsteam", tGeneratedEU)); // Generate superheated steam + addOutput(FluidRegistry.getFluidStack( + "ic2superheatedsteam", tGeneratedEU)); // Generate superheated steam } else { addOutput(GT_ModHandler.getSteam(tGeneratedEU)); // Generate regular steam } } else { - GT_Log.exp.println(this.mName+" had no more Distilled water!"); + GT_Log.exp.println(this.mName + " had no more Distilled water!"); explodeMultiblock(); // Generate crater } } @@ -285,6 +329,7 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM public int getDamageToComponent(ItemStack aStack) { return 0; } + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return false; @@ -302,20 +347,26 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM @Override public String[] getInfoData() { - return new String[]{ - StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", - StatCollector.translateToLocal("GT5U.multiblock.usage") + " " + StatCollector.translateToLocal("GT5U.LHE.steam") + ": " + - (superheated ? EnumChatFormatting.RED : EnumChatFormatting.YELLOW) + GT_Utility.formatNumbers(superheated ? -2 * mEUt : -mEUt) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + - EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + - StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " + - EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - StatCollector.translateToLocal("GT5U.LHE.superheated") + ": " + - (superheated ? EnumChatFormatting.RED : EnumChatFormatting.BLUE) + superheated + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.LHE.superheated") + " " + StatCollector.translateToLocal("GT5U.LHE.threshold") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(superheated_threshold) + EnumChatFormatting.RESET + return new String[] { + StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", + StatCollector.translateToLocal("GT5U.multiblock.usage") + " " + + StatCollector.translateToLocal("GT5U.LHE.steam") + ": " + + (superheated ? EnumChatFormatting.RED : EnumChatFormatting.YELLOW) + + GT_Utility.formatNumbers(superheated ? -2 * mEUt : -mEUt) + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + EnumChatFormatting.YELLOW + + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + StatCollector.translateToLocal("GT5U.LHE.superheated") + ": " + + (superheated ? EnumChatFormatting.RED : EnumChatFormatting.BLUE) + superheated + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.LHE.superheated") + " " + + StatCollector.translateToLocal("GT5U.LHE.threshold") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(superheated_threshold) + EnumChatFormatting.RESET }; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java index e0e3124d4c..6f55e3c9a3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java @@ -1,5 +1,9 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static gregtech.api.enums.Textures.BlockIcons.*; + import com.gtnewhorizon.structurelib.structure.IStructureElement; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -15,16 +19,12 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import java.util.ArrayList; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static gregtech.api.enums.Textures.BlockIcons.*; - -public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_CubicMultiBlockBase<GT_MetaTileEntity_ImplosionCompressor> { +public class GT_MetaTileEntity_ImplosionCompressor + extends GT_MetaTileEntity_CubicMultiBlockBase<GT_MetaTileEntity_ImplosionCompressor> { public GT_MetaTileEntity_ImplosionCompressor(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -42,46 +42,71 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Cub protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Implosion Compressor") - .addInfo("Explosions are fun") - .addInfo("Controller block for the Implosion Compressor") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front center") - .addCasingInfo("Solid Steel Machine Casing", 16) - .addStructureInfo("Casings can be replaced with Explosion Warning Signs") - .addEnergyHatch("Any casing", 1) - .addMaintenanceHatch("Any casing", 1) - .addMufflerHatch("Any casing", 1) - .addInputBus("Any casing", 1) - .addOutputBus("Any casing", 1) - .toolTipFinisher("Gregtech"); + .addInfo("Explosions are fun") + .addInfo("Controller block for the Implosion Compressor") + .addPollutionAmount(getPollutionPerSecond(null)) + .addSeparator() + .beginStructureBlock(3, 3, 3, true) + .addController("Front center") + .addCasingInfo("Solid Steel Machine Casing", 16) + .addStructureInfo("Casings can be replaced with Explosion Warning Signs") + .addEnergyHatch("Any casing", 1) + .addMaintenanceHatch("Any casing", 1) + .addMufflerHatch("Any casing", 1) + .addInputBus("Any casing", 1) + .addOutputBus("Any casing", 1) + .toolTipFinisher("Gregtech"); return tt; } @Override public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - return super.addToMachineList(aTileEntity, aBaseCasingIndex) || addMufflerToMachineList(aTileEntity, aBaseCasingIndex); + return super.addToMachineList(aTileEntity, aBaseCasingIndex) + || addMufflerToMachineList(aTileEntity, aBaseCasingIndex); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { - if (aActive) return new ITexture[]{ - BlockIcons.casingTexturePages[0][16], - TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + if (aActive) + return new ITexture[] { + BlockIcons.casingTexturePages[0][16], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { BlockIcons.casingTexturePages[0][16], - TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][16]}; + return new ITexture[] {Textures.BlockIcons.casingTexturePages[0][16]}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ImplosionCompressor.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ImplosionCompressor.png"); } @Override @@ -114,19 +139,19 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Cub } ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]); if (!tInputList.isEmpty()) { - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sImplosionRecipes.findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sImplosionRecipes.findRecipe( + getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; - //OC THAT EXPLOSIVE SHIT!!! + // OC THAT EXPLOSIVE SHIT!!! calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, getMaxInputVoltage()); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; + // In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; if (this.mEUt > 0) { this.mEUt = (-this.mEUt); } - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + this.mOutputItems = new ItemStack[] {tRecipe.getOutput(0), tRecipe.getOutput(1)}; sendLoopStart((byte) 20); updateSlots(); return true; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_IntegratedOreFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_IntegratedOreFactory.java index c66ed732d9..8afdfa65b7 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_IntegratedOreFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_IntegratedOreFactory.java @@ -1,5 +1,11 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofFrame; + import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; @@ -19,6 +25,8 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import java.util.*; +import java.util.stream.Collectors; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -28,17 +36,9 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import java.util.*; -import java.util.stream.Collectors; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofFrame; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; - -public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_IntegratedOreFactory> implements ISurvivalConstructable { +public class GT_MetaTileEntity_IntegratedOreFactory + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_IntegratedOreFactory> + implements ISurvivalConstructable { private static final int CASING_INDEX1 = 183; private static final int CASING_INDEX2 = 49; @@ -50,50 +50,57 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En private static final String SIFTER = "Sifter"; private static final String CHEM_WASH = "Chemical Bathing"; private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GT_MetaTileEntity_IntegratedOreFactory> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_IntegratedOreFactory>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {" ", " ", " WWW ", " WWW ", " ", " "}, - {" ", " sss ", " sppps", " sppps", " sss ", " "}, - {" ", " sss ", " s s", " s s", " sss ", " "}, - {" ", " sss ", " sppps", " sppps", " sss ", " "}, - {" ", " sss ", " s s", " s s", " sss ", " "}, - {" ", " sss ", " sppps", " sppps", " sss ", " "}, - {"iiiiii ", "iIIIIiisssi", "iIIIIis s", "iIIIIis s", "iIIIIiisssi", "iiiiii "}, - {"iggggi ", "gt t isssi", "g xx sppps", "g xx sppps", "gt t isssi", "iggggi "}, - {"iggggi ", "gt t isssi", "g xx s s", "g xx s s", "gt t isssi", "iggggi "}, - {"iggggi ", "gt t is~si", "g xx spppO", "g xx spppO", "gt t isssi", "iggggi "}, - {"iggggi ", "gt t isssi", "g xx s O", "g xx s O", "gt t isssi", "iggggi "}, - {"EEEEEE ", "EEEEEEEEEEE", "EEEEEEEEEEE", "EEEEEEEEEEE", "EEEEEEEEEEE", "EEEEEE "} - })) - .addElement('i', ofBlock(GregTech_API.sBlockCasings8, 7)) - .addElement('s', ofBlock(GregTech_API.sBlockCasings4, 1)) - .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass"))) - .addElement('x', ofBlock(GregTech_API.sBlockCasings2, 3)) - .addElement('p', ofBlock(GregTech_API.sBlockCasings2, 15)) - .addElement('t', ofFrame(Materials.TungstenSteel)) - .addElement('E', buildHatchAdder(GT_MetaTileEntity_IntegratedOreFactory.class) - .atLeast(Energy, Maintenance) - .casingIndex(CASING_INDEX1) - .dot(1) - .buildAndChain(GregTech_API.sBlockCasings8, 7) - ) - .addElement('I', buildHatchAdder(GT_MetaTileEntity_IntegratedOreFactory.class) - .atLeast(InputBus) - .casingIndex(CASING_INDEX1) - .dot(2) - .buildAndChain(GregTech_API.sBlockCasings8, 7) - ) - .addElement('W', buildHatchAdder(GT_MetaTileEntity_IntegratedOreFactory.class) - .atLeast(InputHatch, Muffler) - .casingIndex(CASING_INDEX1) - .dot(3) - .buildAndChain(GregTech_API.sBlockCasings4, 1)) - .addElement('O', buildHatchAdder(GT_MetaTileEntity_IntegratedOreFactory.class) - .atLeast(OutputBus, OutputHatch) - .casingIndex(CASING_INDEX2) - .dot(4) - .buildAndChain(GregTech_API.sBlockCasings4, 1)) - .build(); + private static final IStructureDefinition<GT_MetaTileEntity_IntegratedOreFactory> STRUCTURE_DEFINITION = + StructureDefinition.<GT_MetaTileEntity_IntegratedOreFactory>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {" ", " ", " WWW ", " WWW ", " ", " "}, + {" ", " sss ", " sppps", " sppps", " sss ", " "}, + {" ", " sss ", " s s", " s s", " sss ", " "}, + {" ", " sss ", " sppps", " sppps", " sss ", " "}, + {" ", " sss ", " s s", " s s", " sss ", " "}, + {" ", " sss ", " sppps", " sppps", " sss ", " "}, + {"iiiiii ", "iIIIIiisssi", "iIIIIis s", "iIIIIis s", "iIIIIiisssi", "iiiiii "}, + {"iggggi ", "gt t isssi", "g xx sppps", "g xx sppps", "gt t isssi", "iggggi "}, + {"iggggi ", "gt t isssi", "g xx s s", "g xx s s", "gt t isssi", "iggggi "}, + {"iggggi ", "gt t is~si", "g xx spppO", "g xx spppO", "gt t isssi", "iggggi "}, + {"iggggi ", "gt t isssi", "g xx s O", "g xx s O", "gt t isssi", "iggggi "}, + {"EEEEEE ", "EEEEEEEEEEE", "EEEEEEEEEEE", "EEEEEEEEEEE", "EEEEEEEEEEE", "EEEEEE "} + })) + .addElement('i', ofBlock(GregTech_API.sBlockCasings8, 7)) + .addElement('s', ofBlock(GregTech_API.sBlockCasings4, 1)) + .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass"))) + .addElement('x', ofBlock(GregTech_API.sBlockCasings2, 3)) + .addElement('p', ofBlock(GregTech_API.sBlockCasings2, 15)) + .addElement('t', ofFrame(Materials.TungstenSteel)) + .addElement( + 'E', + buildHatchAdder(GT_MetaTileEntity_IntegratedOreFactory.class) + .atLeast(Energy, Maintenance) + .casingIndex(CASING_INDEX1) + .dot(1) + .buildAndChain(GregTech_API.sBlockCasings8, 7)) + .addElement( + 'I', + buildHatchAdder(GT_MetaTileEntity_IntegratedOreFactory.class) + .atLeast(InputBus) + .casingIndex(CASING_INDEX1) + .dot(2) + .buildAndChain(GregTech_API.sBlockCasings8, 7)) + .addElement( + 'W', + buildHatchAdder(GT_MetaTileEntity_IntegratedOreFactory.class) + .atLeast(InputHatch, Muffler) + .casingIndex(CASING_INDEX1) + .dot(3) + .buildAndChain(GregTech_API.sBlockCasings4, 1)) + .addElement( + 'O', + buildHatchAdder(GT_MetaTileEntity_IntegratedOreFactory.class) + .atLeast(OutputBus, OutputHatch) + .casingIndex(CASING_INDEX2) + .dot(4) + .buildAndChain(GregTech_API.sBlockCasings4, 1)) + .build(); private static final HashSet<Integer> isCrushedOre = new HashSet<>(); private static final HashSet<Integer> isCrushedPureOre = new HashSet<>(); @@ -169,24 +176,24 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Ore Processor") - .addInfo("Controller Block for the Integrated Ore Factory") - .addInfo("It is OP. I mean ore processor.") - .addInfo("Do all ore procession in one step.") - .addInfo("Can process up to 1024 ores per time.") - .addInfo("Every ore costs 30EU/t, 2L lubricant, 200L distilled water.") - .addInfo("Process time is depend on mode.") - .addInfo("Use a screwdriver to switch mode.") - .addInfo("Sneak click with screwdriver to void the stone dusts.") - .addSeparator() - .beginStructureBlock(6, 12, 11, false) - .addController("The third layer") - .addEnergyHatch("Button Casing", 1) - .addMaintenanceHatch("Button Casing", 1) - .addInputBus("Input ore/crushed ore", 2) - .addInputHatch("Input lubricant/distilled water/washing chemicals", 3) - .addMufflerHatch("Output Pollution", 3) - .addOutputBus("Output products", 4) - .toolTipFinisher("Gregtech"); + .addInfo("Controller Block for the Integrated Ore Factory") + .addInfo("It is OP. I mean ore processor.") + .addInfo("Do all ore procession in one step.") + .addInfo("Can process up to 1024 ores per time.") + .addInfo("Every ore costs 30EU/t, 2L lubricant, 200L distilled water.") + .addInfo("Process time is depend on mode.") + .addInfo("Use a screwdriver to switch mode.") + .addInfo("Sneak click with screwdriver to void the stone dusts.") + .addSeparator() + .beginStructureBlock(6, 12, 11, false) + .addController("The third layer") + .addEnergyHatch("Button Casing", 1) + .addMaintenanceHatch("Button Casing", 1) + .addInputBus("Input ore/crushed ore", 2) + .addInputHatch("Input lubricant/distilled water/washing chemicals", 3) + .addMufflerHatch("Output Pollution", 3) + .addOutputBus("Output products", 4) + .toolTipFinisher("Gregtech"); return tt; } @@ -224,7 +231,7 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En case 4: return 17 * 20; } - //go to hell + // go to hell return 1000000000; } @@ -260,8 +267,12 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En if (tCharged <= 0) break; int tID = GT_Utility.stackToInt(ore); if (tID == 0) continue; - if (isPureDust.contains(tID) || isImpureDust.contains(tID) || isCrushedPureOre.contains(tID) || - isThermal.contains(tID) || isCrushedOre.contains(tID) || isOre.contains(tID)) { + if (isPureDust.contains(tID) + || isImpureDust.contains(tID) + || isCrushedPureOre.contains(tID) + || isThermal.contains(tID) + || isCrushedOre.contains(tID) + || isOre.contains(tID)) { if (ore.stackSize <= tCharged) { tRealUsed += ore.stackSize; tOres.add(GT_Utility.copy(ore)); @@ -345,20 +356,33 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { sVoidStone = !sVoidStone; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocalFormatted("GT5U.machines.oreprocessor.void", sVoidStone)); + GT_Utility.sendChatToPlayer( + aPlayer, StatCollector.translateToLocalFormatted("GT5U.machines.oreprocessor.void", sVoidStone)); return; } sMode = (sMode + 1) % 5; String des; switch (sMode) { - case 0: des = EnumChatFormatting.AQUA + CRUSH + "->" + WASH + "->" + THERMAL + "->" + CRUSH; break; - case 1: des = EnumChatFormatting.AQUA + CRUSH + "->" + WASH + "->" + CRUSH + "->" + CENTRIFUGE; break; - case 2: des = EnumChatFormatting.AQUA + CRUSH + "->" + CRUSH + "->" + CENTRIFUGE; break; - case 3: des = EnumChatFormatting.AQUA + CRUSH + "->" + WASH + "->" + SIFTER; break; - case 4: des = EnumChatFormatting.AQUA + CRUSH + "->" + CHEM_WASH + "->" + CRUSH + "->" + CENTRIFUGE; break; - default: des = ""; + case 0: + des = EnumChatFormatting.AQUA + CRUSH + "->" + WASH + "->" + THERMAL + "->" + CRUSH; + break; + case 1: + des = EnumChatFormatting.AQUA + CRUSH + "->" + WASH + "->" + CRUSH + "->" + CENTRIFUGE; + break; + case 2: + des = EnumChatFormatting.AQUA + CRUSH + "->" + CRUSH + "->" + CENTRIFUGE; + break; + case 3: + des = EnumChatFormatting.AQUA + CRUSH + "->" + WASH + "->" + SIFTER; + break; + case 4: + des = EnumChatFormatting.AQUA + CRUSH + "->" + CHEM_WASH + "->" + CRUSH + "->" + CENTRIFUGE; + break; + default: + des = ""; } - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocalFormatted("GT5U.machines.oreprocessor", des, getTime() / 20)); + GT_Utility.sendChatToPlayer( + aPlayer, StatCollector.translateToLocalFormatted("GT5U.machines.oreprocessor", des, getTime() / 20)); } @Override @@ -382,7 +406,8 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En for (ItemStack aStack : sMidProduct) { int tID = GT_Utility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, GT_Values.V[15], null, aStack); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe( + getBaseMetaTileEntity(), false, GT_Values.V[15], null, aStack); if (tRecipe != null) { tProduct.addAll(getOutputStack(tRecipe, aStack.stackSize)); } else { @@ -403,7 +428,12 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En for (ItemStack aStack : sMidProduct) { int tID = GT_Utility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe(getBaseMetaTileEntity(), false, GT_Values.V[15], new FluidStack[]{GT_ModHandler.getDistilledWater(Integer.MAX_VALUE)}, aStack); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.findRecipe( + getBaseMetaTileEntity(), + false, + GT_Values.V[15], + new FluidStack[] {GT_ModHandler.getDistilledWater(Integer.MAX_VALUE)}, + aStack); if (tRecipe != null) { tProduct.addAll(getOutputStack(tRecipe, aStack.stackSize)); } else { @@ -424,7 +454,8 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En for (ItemStack aStack : sMidProduct) { int tID = GT_Utility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes.findRecipe(getBaseMetaTileEntity(), false, GT_Values.V[15], null, aStack); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes.findRecipe( + getBaseMetaTileEntity(), false, GT_Values.V[15], null, aStack); if (tRecipe != null) { tProduct.addAll(getOutputStack(tRecipe, aStack.stackSize)); } else { @@ -445,7 +476,8 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En for (ItemStack aStack : sMidProduct) { int tID = GT_Utility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.findRecipe(getBaseMetaTileEntity(), false, GT_Values.V[15], null, aStack); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.findRecipe( + getBaseMetaTileEntity(), false, GT_Values.V[15], null, aStack); if (tRecipe != null) { tProduct.addAll(getOutputStack(tRecipe, aStack.stackSize)); } else { @@ -466,7 +498,8 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En for (ItemStack aStack : sMidProduct) { int tID = GT_Utility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sSifterRecipes.findRecipe(getBaseMetaTileEntity(), false, GT_Values.V[15], null, aStack); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sSifterRecipes.findRecipe( + getBaseMetaTileEntity(), false, GT_Values.V[15], null, aStack); if (tRecipe != null) { tProduct.addAll(getOutputStack(tRecipe, aStack.stackSize)); } else { @@ -487,9 +520,15 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En for (ItemStack aStack : sMidProduct) { int tID = GT_Utility.stackToInt(aStack); if (checkTypes(tID, aTables)) { - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sChemicalBathRecipes.findRecipe(getBaseMetaTileEntity(), false, GT_Values.V[15], getStoredFluids().toArray(new FluidStack[0]), aStack); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sChemicalBathRecipes.findRecipe( + getBaseMetaTileEntity(), + false, + GT_Values.V[15], + getStoredFluids().toArray(new FluidStack[0]), + aStack); if (tRecipe != null && tRecipe.getRepresentativeFluidInput(0) != null) { - FluidStack tInputFluid = tRecipe.getRepresentativeFluidInput(0).copy(); + FluidStack tInputFluid = + tRecipe.getRepresentativeFluidInput(0).copy(); int tStored = getFluidAmount(tInputFluid); int tWashed = Math.min(tStored / tInputFluid.amount, aStack.stackSize); depleteInput(new FluidStack(tInputFluid.getFluid(), tWashed * tInputFluid.amount)); @@ -521,7 +560,7 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En private List<ItemStack> getOutputStack(GT_Recipe aRecipe, int aTime) { List<ItemStack> tOutput = new ArrayList<>(); - for (int i = 0; i < aRecipe.mOutputs.length; i ++) { + for (int i = 0; i < aRecipe.mOutputs.length; i++) { if (aRecipe.getOutput(i) == null) { continue; } @@ -529,12 +568,13 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En if (tChance == 10000) { tOutput.add(GT_Utility.copyAmountUnsafe(aTime * aRecipe.getOutput(i).stackSize, aRecipe.getOutput(i))); } else { - //Use Normal Distribution + // Use Normal Distribution double u = aTime * (tChance / 10000D); double e = aTime * (tChance / 10000D) * (1 - (tChance / 10000D)); Random random = new Random(); int tAmount = (int) Math.ceil(Math.sqrt(e) * random.nextGaussian() + u); - tOutput.add(GT_Utility.copyAmountUnsafe(tAmount * aRecipe.getOutput(i).stackSize, aRecipe.getOutput(i))); + tOutput.add( + GT_Utility.copyAmountUnsafe(tAmount * aRecipe.getOutput(i).stackSize, aRecipe.getOutput(i))); } } return tOutput.stream().filter(i -> (i != null && i.stackSize > 0)).collect(Collectors.toList()); @@ -562,13 +602,15 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En for (Integer id : rProduct.keySet()) { ItemStack stack = GT_Utility.intToStack(id); sMidProduct[cnt] = GT_Utility.copyAmountUnsafe(rProduct.get(id), stack); - cnt ++; + cnt++; } } @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - return checkPiece(STRUCTURE_PIECE_MAIN, 8, 9, 1) && mMaintenanceHatches.size() <= 1 && !mMufflerHatches.isEmpty(); + return checkPiece(STRUCTURE_PIECE_MAIN, 8, 9, 1) + && mMaintenanceHatches.size() <= 1 + && !mMufflerHatches.isEmpty(); } @Override @@ -597,18 +639,40 @@ public class GT_MetaTileEntity_IntegratedOreFactory extends GT_MetaTileEntity_En } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { if (aActive) - return new ITexture[]{ + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX2), - TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX2), - TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PROCESSING_ARRAY) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_INDEX2)}; + return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_INDEX2)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java index b45875d9e7..323b6bd2a9 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java @@ -1,5 +1,18 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.GT_Values.STEAM_PER_WATER; +import static gregtech.api.enums.ItemList.Circuit_Integrated; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_GLOW; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; + import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -20,6 +33,7 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; @@ -28,63 +42,49 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.GT_Values.STEAM_PER_WATER; -import static gregtech.api.enums.ItemList.Circuit_Integrated; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_GLOW; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_LargeBoiler> implements ISurvivalConstructable { +public abstract class GT_MetaTileEntity_LargeBoiler + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_LargeBoiler> + implements ISurvivalConstructable { private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeBoiler>> STRUCTURE_DEFINITION =new ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeBoiler>>() { - @Override - protected IStructureDefinition<GT_MetaTileEntity_LargeBoiler> computeValue(Class<?> type) { - return StructureDefinition.<GT_MetaTileEntity_LargeBoiler>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {"ccc", "ccc", "ccc"}, - {"ccc", "cPc", "ccc"}, - {"ccc", "cPc", "ccc"}, - {"ccc", "cPc", "ccc"}, - {"f~f", "fff", "fff"}, - })) - .addElement('P', lazy(t -> ofBlock(t.getPipeBlock(), t.getPipeMeta()))) - .addElement('c', lazy(t -> - buildHatchAdder(GT_MetaTileEntity_LargeBoiler.class) - .atLeast(OutputHatch) - .casingIndex(t.getCasingTextureIndex()) - .dot(2) - .buildAndChain(onElementPass(GT_MetaTileEntity_LargeBoiler::onCasingAdded, ofBlock(t.getCasingBlock(), t.getCasingMeta()))) - )) - .addElement('f', lazy(t -> - buildHatchAdder(GT_MetaTileEntity_LargeBoiler.class) - .atLeast(Maintenance, InputHatch, InputBus, Muffler) - .casingIndex(t.getFireboxTextureIndex()) - .dot(1) - .buildAndChain(onElementPass(GT_MetaTileEntity_LargeBoiler::onFireboxAdded, ofBlock(t.getFireboxBlock(), t.getFireboxMeta()))) - )) - .build(); - } - }; + private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeBoiler>> STRUCTURE_DEFINITION = + new ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeBoiler>>() { + @Override + protected IStructureDefinition<GT_MetaTileEntity_LargeBoiler> computeValue(Class<?> type) { + return StructureDefinition.<GT_MetaTileEntity_LargeBoiler>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {"ccc", "ccc", "ccc"}, + {"ccc", "cPc", "ccc"}, + {"ccc", "cPc", "ccc"}, + {"ccc", "cPc", "ccc"}, + {"f~f", "fff", "fff"}, + })) + .addElement('P', lazy(t -> ofBlock(t.getPipeBlock(), t.getPipeMeta()))) + .addElement('c', lazy(t -> buildHatchAdder(GT_MetaTileEntity_LargeBoiler.class) + .atLeast(OutputHatch) + .casingIndex(t.getCasingTextureIndex()) + .dot(2) + .buildAndChain(onElementPass( + GT_MetaTileEntity_LargeBoiler::onCasingAdded, + ofBlock(t.getCasingBlock(), t.getCasingMeta()))))) + .addElement('f', lazy(t -> buildHatchAdder(GT_MetaTileEntity_LargeBoiler.class) + .atLeast(Maintenance, InputHatch, InputBus, Muffler) + .casingIndex(t.getFireboxTextureIndex()) + .dot(1) + .buildAndChain(onElementPass( + GT_MetaTileEntity_LargeBoiler::onFireboxAdded, + ofBlock(t.getFireboxBlock(), t.getFireboxMeta()))))) + .build(); + } + }; private boolean firstRun = true; private int mSuperEfficencyIncrease = 0; - private int integratedCircuitConfig = 0; //Steam output is reduced by 1000L per config - private int excessWater = 0; //Eliminate rounding errors for water - private int excessFuel = 0; //Eliminate rounding errors for fuels that burn half items - private int excessProjectedEU = 0; //Eliminate rounding errors from throttling the boiler + private int integratedCircuitConfig = 0; // Steam output is reduced by 1000L per config + private int excessWater = 0; // Eliminate rounding errors for water + private int excessFuel = 0; // Eliminate rounding errors for fuels that burn half items + private int excessProjectedEU = 0; // Eliminate rounding errors from throttling the boiler private int mCasingAmount; private int mFireboxAmount; - protected int pollutionPerSecond = 1; //placeholder for the child classes + protected int pollutionPerSecond = 1; // placeholder for the child classes public GT_MetaTileEntity_LargeBoiler(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -98,26 +98,30 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Boiler") - .addInfo("Controller block for the Large " + getCasingMaterial() + " Boiler"); - // Tooltip differs between the boilers that output Superheated Steam (Titanium and Tungstensteel) and the ones that do not (Bronze and Steel) - if (isSuperheated()) { - tt.addInfo("Produces " + (getEUt() * 40) * ((runtimeBoost(20) / (20f)) / superToNormalSteam) + "L of Superheated Steam with 1 Coal at " + (getEUt() * 40) / superToNormalSteam + "L/s")//? + tt.addMachineType("Boiler").addInfo("Controller block for the Large " + getCasingMaterial() + " Boiler"); + // Tooltip differs between the boilers that output Superheated Steam (Titanium and Tungstensteel) and the ones + // that do not (Bronze and Steel) + if (isSuperheated()) { + tt.addInfo("Produces " + (getEUt() * 40) * ((runtimeBoost(20) / (20f)) / superToNormalSteam) + + "L of Superheated Steam with 1 Coal at " + (getEUt() * 40) / superToNormalSteam + + "L/s") // ? .addInfo("A programmed circuit in the main block throttles the boiler (-1000L/s per config)") .addInfo("Only some solid fuels are allowed (check the NEI Large Boiler tab for details)") .addInfo("If there are any disallowed fuels in the input bus, the boiler won't run!"); - } - else { - tt.addInfo("Produces " + (getEUt() * 40) * (runtimeBoost(20) / 20f) + "L of Steam with 1 Coal at " + getEUt() * 40 + "L/s")//? + } else { + tt.addInfo("Produces " + (getEUt() * 40) * (runtimeBoost(20) / 20f) + "L of Steam with 1 Coal at " + + getEUt() * 40 + "L/s") // ? .addInfo("A programmed circuit in the main block throttles the boiler (-1000L/s per config)") .addInfo("Solid Fuels with a burn value that is too high or too low will not work"); - } - tt.addInfo(String.format("Diesel fuels have 1/4 efficiency - Takes %.2f seconds to heat up", 500.0 / getEfficiencyIncrease()))//? check semifluid again + } + tt.addInfo(String.format( + "Diesel fuels have 1/4 efficiency - Takes %.2f seconds to heat up", + 500.0 / getEfficiencyIncrease())) // ? check semifluid again .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginStructureBlock(3, 5, 3, false) .addController("Front bottom") - .addCasingInfo(getCasingMaterial() + " " + getCasingBlockType() + " Casing", 24)//? + .addCasingInfo(getCasingMaterial() + " " + getCasingBlockType() + " Casing", 24) // ? .addOtherStructurePart(getCasingMaterial() + " Fire Boxes", "Bottom layer, 3 minimum") .addOtherStructurePart(getCasingMaterial() + " Pipe Casing Blocks", "Inner 3 blocks") .addMaintenanceHatch("Any firebox", 1) @@ -156,34 +160,59 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En public abstract int getEfficiencyIncrease(); - public int getIntegratedCircuitConfig(){ + public int getIntegratedCircuitConfig() { return integratedCircuitConfig; } @Override public int getPollutionPerSecond(ItemStack aStack) { - //allows for 0 pollution if circuit throttle is too high - return Math.max(0, (int) (pollutionPerSecond * (1-GT_Mod.gregtechproxy.mPollutionReleasedByThrottle*getIntegratedCircuitConfig()))); + // allows for 0 pollution if circuit throttle is too high + return Math.max(0, (int) (pollutionPerSecond + * (1 - GT_Mod.gregtechproxy.mPollutionReleasedByThrottle * getIntegratedCircuitConfig()))); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { - if (aActive) return new ITexture[]{ + if (aActive) + return new ITexture[] { BlockIcons.getCasingTextureForId(getCasingTextureIndex()), - TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ - BlockIcons.getCasingTextureForId(getCasingTextureIndex()), - TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_LARGE_BOILER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_LARGE_BOILER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + BlockIcons.getCasingTextureForId(getCasingTextureIndex()), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_LARGE_BOILER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_LARGE_BOILER_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex())}; + return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex())}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeBoiler.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeBoiler.png"); } @Override @@ -192,11 +221,12 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En } boolean isFuelValid() { - if (!isSuperheated()) - return true; + if (!isSuperheated()) return true; for (ItemStack input : getStoredInputs()) { - if (!GT_Recipe.GT_Recipe_Map_LargeBoilerFakeFuels.isAllowedSolidFuel(input) && !Circuit_Integrated.isStackEqual(input, true, true)) { - //if any item is not in ALLOWED_SOLID_FUELS, operation cannot be allowed because it might still be consumed + if (!GT_Recipe.GT_Recipe_Map_LargeBoilerFakeFuels.isAllowedSolidFuel(input) + && !Circuit_Integrated.isStackEqual(input, true, true)) { + // if any item is not in ALLOWED_SOLID_FUELS, operation cannot be allowed because it might still be + // consumed this.mMaxProgresstime = 0; this.mEUt = 0; return false; @@ -207,9 +237,8 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En @Override public boolean checkRecipe(ItemStack aStack) { - if (!isFuelValid()) - return false; - //Do we have an integrated circuit with a valid configuration? + if (!isFuelValid()) return false; + // Do we have an integrated circuit with a valid configuration? if (Circuit_Integrated.isStackEqual(mInventory[1], true, true)) { int circuit_config = mInventory[1].getItemDamage(); if (circuit_config >= 1 && circuit_config <= 25) { @@ -217,7 +246,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En this.integratedCircuitConfig = circuit_config; } } else { - //If not, set the config to zero + // If not, set the config to zero this.integratedCircuitConfig = 0; } @@ -240,7 +269,8 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En if (tFluid != null) { tFluid.amount = 1000; if (depleteInput(tFluid)) { - this.mMaxProgresstime = adjustBurnTimeForConfig(Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2))); + this.mMaxProgresstime = + adjustBurnTimeForConfig(Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2))); this.mEUt = adjustEUtForConfig(getEUt()); this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease(); return true; @@ -253,15 +283,16 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En if (!tInputList.isEmpty()) { if (isSuperheated()) { for (ItemStack tInput : tInputList) { - if (tInput != GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Lava, 1)){ - if (GT_Utility.getFluidForFilledItem(tInput, true) == null && (this.mMaxProgresstime = GT_ModHandler.getFuelValue(tInput) / 80) > 0) { + if (tInput != GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Lava, 1)) { + if (GT_Utility.getFluidForFilledItem(tInput, true) == null + && (this.mMaxProgresstime = GT_ModHandler.getFuelValue(tInput) / 80) > 0) { this.excessFuel += GT_ModHandler.getFuelValue(tInput) % 80; this.mMaxProgresstime += this.excessFuel / 80; this.excessFuel %= 80; this.mMaxProgresstime = adjustBurnTimeForConfig(runtimeBoost(this.mMaxProgresstime)); this.mEUt = adjustEUtForConfig(getEUt()); this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease(); - this.mOutputItems = new ItemStack[]{GT_Utility.getContainerItem(tInput, true)}; + this.mOutputItems = new ItemStack[] {GT_Utility.getContainerItem(tInput, true)}; tInput.stackSize -= 1; updateSlots(); if (this.mEfficiencyIncrease > 5000) { @@ -272,19 +303,22 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En } } } - } - else { + } else { for (ItemStack tInput : tInputList) { - if (tInput != GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Lava, 1)){ - // Solid fuels with burn values below getEUt are ignored (mostly items like sticks), and also those with very high fuel values that would cause an overflow error. - if (GT_Utility.getFluidForFilledItem(tInput, true) == null && (this.mMaxProgresstime = GT_ModHandler.getFuelValue(tInput) / 80) > 0 && (GT_ModHandler.getFuelValue(tInput) * 2 / this.getEUt()) > 1 && GT_ModHandler.getFuelValue(tInput) < 100000000) { + if (tInput != GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Lava, 1)) { + // Solid fuels with burn values below getEUt are ignored (mostly items like sticks), and also + // those with very high fuel values that would cause an overflow error. + if (GT_Utility.getFluidForFilledItem(tInput, true) == null + && (this.mMaxProgresstime = GT_ModHandler.getFuelValue(tInput) / 80) > 0 + && (GT_ModHandler.getFuelValue(tInput) * 2 / this.getEUt()) > 1 + && GT_ModHandler.getFuelValue(tInput) < 100000000) { this.excessFuel += GT_ModHandler.getFuelValue(tInput) % 80; this.mMaxProgresstime += this.excessFuel / 80; this.excessFuel %= 80; this.mMaxProgresstime = adjustBurnTimeForConfig(runtimeBoost(this.mMaxProgresstime)); this.mEUt = adjustEUtForConfig(getEUt()); this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease(); - this.mOutputItems = new ItemStack[]{GT_Utility.getContainerItem(tInput, true)}; + this.mOutputItems = new ItemStack[] {GT_Utility.getContainerItem(tInput, true)}; tInput.stackSize -= 1; updateSlots(); if (this.mEfficiencyIncrease > 5000) { @@ -296,7 +330,6 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En } } } - } this.mMaxProgresstime = 0; this.mEUt = 0; @@ -307,13 +340,17 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En abstract boolean isSuperheated(); - final private int superToNormalSteam = 3; + private final int superToNormalSteam = 3; @Override public boolean onRunningTick(ItemStack aStack) { if (this.mEUt > 0) { if (this.mSuperEfficencyIncrease > 0) - mEfficiency = Math.max(0, Math.min(mEfficiency + mSuperEfficencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); + mEfficiency = Math.max( + 0, + Math.min( + mEfficiency + mSuperEfficencyIncrease, + getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L); if (tGeneratedEU > 0) { long amount = (tGeneratedEU + STEAM_PER_WATER) / STEAM_PER_WATER; @@ -321,24 +358,26 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En amount -= excessWater / STEAM_PER_WATER; excessWater %= STEAM_PER_WATER; if (isSuperheated()) { - // Consumes only one third of the water if producing Superheated Steam, to maintain water in the chain. - if (depleteInput(Materials.Water.getFluid(amount / superToNormalSteam)) || depleteInput(GT_ModHandler.getDistilledWater(amount / superToNormalSteam))) { - // Outputs Superheated Steam instead of Steam, at one third of the amount (equivalent in power output to the normal Steam amount). - addOutput(FluidRegistry.getFluidStack("ic2superheatedsteam", tGeneratedEU / superToNormalSteam)); + // Consumes only one third of the water if producing Superheated Steam, to maintain water in the + // chain. + if (depleteInput(Materials.Water.getFluid(amount / superToNormalSteam)) + || depleteInput(GT_ModHandler.getDistilledWater(amount / superToNormalSteam))) { + // Outputs Superheated Steam instead of Steam, at one third of the amount (equivalent in power + // output to the normal Steam amount). + addOutput( + FluidRegistry.getFluidStack("ic2superheatedsteam", tGeneratedEU / superToNormalSteam)); } else { GT_Log.exp.println("Boiler " + this.mName + " had no Water!"); explodeMultiblock(); } - } - - else { - if (depleteInput(Materials.Water.getFluid(amount)) || depleteInput(GT_ModHandler.getDistilledWater(amount))) { + } else { + if (depleteInput(Materials.Water.getFluid(amount)) + || depleteInput(GT_ModHandler.getDistilledWater(amount))) { addOutput(GT_ModHandler.getSteam(tGeneratedEU)); } else { GT_Log.exp.println("Boiler " + this.mName + " had no Water!"); explodeMultiblock(); } - } } return true; @@ -366,7 +405,9 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (mProgresstime > 0 && firstRun) { firstRun = false; - GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "extremepressure"); + GT_Mod.achievements.issueAchievement( + aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + "extremepressure"); } super.onPostTick(aBaseMetaTileEntity, aTick); } @@ -388,8 +429,11 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasingAmount = 0; mFireboxAmount = 0; - return checkPiece(STRUCTURE_PIECE_MAIN, 1, 4, 0) && mCasingAmount >= 24 && mFireboxAmount >= 3 && - mMaintenanceHatches.size() == 1 && !mMufflerHatches.isEmpty(); + return checkPiece(STRUCTURE_PIECE_MAIN, 1, 4, 0) + && mCasingAmount >= 24 + && mFireboxAmount >= 3 + && mMaintenanceHatches.size() == 1 + && !mMufflerHatches.isEmpty(); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java index 0fa1b98f59..970000da11 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java @@ -5,7 +5,6 @@ import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_LargeBoiler_Bronze extends GT_MetaTileEntity_LargeBoiler { @@ -25,8 +24,8 @@ public class GT_MetaTileEntity_LargeBoiler_Bronze extends GT_MetaTileEntity_Larg } @Override - public String getCasingMaterial(){ - return "Bronze"; + public String getCasingMaterial() { + return "Bronze"; } @Override @@ -90,5 +89,7 @@ public class GT_MetaTileEntity_LargeBoiler_Bronze extends GT_MetaTileEntity_Larg } @Override - boolean isSuperheated() { return false; } + boolean isSuperheated() { + return false; + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java index 2ed236f676..bc30228b3a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java @@ -5,7 +5,6 @@ import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_LargeBoiler_Steel extends GT_MetaTileEntity_LargeBoiler { public GT_MetaTileEntity_LargeBoiler_Steel(int aID, String aName, String aNameRegional) { @@ -24,8 +23,8 @@ public class GT_MetaTileEntity_LargeBoiler_Steel extends GT_MetaTileEntity_Large } @Override - public String getCasingMaterial(){ - return "Steel"; + public String getCasingMaterial() { + return "Steel"; } @Override @@ -84,8 +83,12 @@ public class GT_MetaTileEntity_LargeBoiler_Steel extends GT_MetaTileEntity_Large } @Override - int runtimeBoost(int mTime) { return mTime; } + int runtimeBoost(int mTime) { + return mTime; + } @Override - boolean isSuperheated() { return false; } + boolean isSuperheated() { + return false; + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java index 8ae4b6034a..bda83f7210 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java @@ -4,9 +4,7 @@ import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map_LargeBoilerFakeFuels; import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_LargeBoiler_Titanium extends GT_MetaTileEntity_LargeBoiler { public GT_MetaTileEntity_LargeBoiler_Titanium(int aID, String aName, String aNameRegional) { @@ -25,14 +23,14 @@ public class GT_MetaTileEntity_LargeBoiler_Titanium extends GT_MetaTileEntity_La } @Override - public String getCasingMaterial(){ - return "Titanium"; + public String getCasingMaterial() { + return "Titanium"; } - @Override - public String getCasingBlockType() { - return "Machine Casings"; - } + @Override + public String getCasingBlockType() { + return "Machine Casings"; + } @Override public Block getCasingBlock() { @@ -90,5 +88,7 @@ public class GT_MetaTileEntity_LargeBoiler_Titanium extends GT_MetaTileEntity_La } @Override - boolean isSuperheated() { return true; } + boolean isSuperheated() { + return true; + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java index e1e6e18091..3b73b4f407 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java @@ -4,9 +4,7 @@ import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map_LargeBoilerFakeFuels; import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_LargeBoiler_TungstenSteel extends GT_MetaTileEntity_LargeBoiler { public GT_MetaTileEntity_LargeBoiler_TungstenSteel(int aID, String aName, String aNameRegional) { @@ -25,8 +23,8 @@ public class GT_MetaTileEntity_LargeBoiler_TungstenSteel extends GT_MetaTileEnti } @Override - public String getCasingMaterial(){ - return "TungstenSteel"; + public String getCasingMaterial() { + return "TungstenSteel"; } @Override @@ -85,8 +83,12 @@ public class GT_MetaTileEntity_LargeBoiler_TungstenSteel extends GT_MetaTileEnti } @Override - int runtimeBoost(int mTime) { return mTime * 120 / 750; } + int runtimeBoost(int mTime) { + return mTime * 120 / 750; + } @Override - boolean isSuperheated() { return true; } + boolean isSuperheated() { + return true; + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java index 54758167f1..d27bd429af 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java @@ -1,5 +1,16 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; + import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.*; @@ -17,6 +28,8 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Single_Recipe_Check; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.function.Consumer; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; @@ -25,48 +38,40 @@ import net.minecraft.util.IChatComponent; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.function.Consumer; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_LargeChemicalReactor> implements ISurvivalConstructable { +public class GT_MetaTileEntity_LargeChemicalReactor + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_LargeChemicalReactor> + implements ISurvivalConstructable { private static final int CASING_INDEX = 176; private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GT_MetaTileEntity_LargeChemicalReactor> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_LargeChemicalReactor>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {"ccc", "cxc", "ccc"}, - {"c~c", "xPx", "cxc"}, - {"ccc", "cxc", "ccc"}, - })) - .addElement('P', ofBlock(GregTech_API.sBlockCasings8, 1)) - .addElement('c', buildHatchAdder(GT_MetaTileEntity_LargeChemicalReactor.class) - .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Maintenance, Energy) - .casingIndex(CASING_INDEX) - .dot(1) - .buildAndChain(onElementPass(GT_MetaTileEntity_LargeChemicalReactor::onCasingAdded, ofBlock(GregTech_API.sBlockCasings8, 0)) - )) - .addElement('x', buildHatchAdder(GT_MetaTileEntity_LargeChemicalReactor.class) - .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Maintenance, Energy) - .casingIndex(CASING_INDEX) - .dot(1) - .buildAndChain( - CoilStructureElement.INSTANCE, - onElementPass(GT_MetaTileEntity_LargeChemicalReactor::onCasingAdded, ofBlock(GregTech_API.sBlockCasings8, 0)) - ) - ) - .build(); + private static final IStructureDefinition<GT_MetaTileEntity_LargeChemicalReactor> STRUCTURE_DEFINITION = + StructureDefinition.<GT_MetaTileEntity_LargeChemicalReactor>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {"ccc", "cxc", "ccc"}, + {"c~c", "xPx", "cxc"}, + {"ccc", "cxc", "ccc"}, + })) + .addElement('P', ofBlock(GregTech_API.sBlockCasings8, 1)) + .addElement( + 'c', + buildHatchAdder(GT_MetaTileEntity_LargeChemicalReactor.class) + .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Maintenance, Energy) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain(onElementPass( + GT_MetaTileEntity_LargeChemicalReactor::onCasingAdded, + ofBlock(GregTech_API.sBlockCasings8, 0)))) + .addElement( + 'x', + buildHatchAdder(GT_MetaTileEntity_LargeChemicalReactor.class) + .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Maintenance, Energy) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain( + CoilStructureElement.INSTANCE, + onElementPass( + GT_MetaTileEntity_LargeChemicalReactor::onCasingAdded, + ofBlock(GregTech_API.sBlockCasings8, 0)))) + .build(); private int mCasingAmount; private int mCoilAmount; @@ -109,24 +114,47 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_En } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, - boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { - if (aActive) return new ITexture[]{ - casingTexturePages[1][48], - TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + if (aActive) + return new ITexture[] { casingTexturePages[1][48], - TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + casingTexturePages[1][48], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{casingTexturePages[1][48]}; + return new ITexture[] {casingTexturePages[1][48]}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeChemicalReactor.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeChemicalReactor.png"); } @Override @@ -168,15 +196,16 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_En tSingleRecipeCheckBuilder = GT_Single_Recipe_Check.builder(this).setBefore(); } - tRecipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false, - false, gregtech.api.enums.GT_Values.V[tier], fluids, inputs); + tRecipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.findRecipe( + getBaseMetaTileEntity(), false, false, gregtech.api.enums.GT_Values.V[tier], fluids, inputs); if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, fluids, inputs)) { return false; } if (mLockedToSingleRecipe) { - mSingleRecipeCheck = tSingleRecipeCheckBuilder.setAfter().setRecipe(tRecipe).build(); + mSingleRecipeCheck = + tSingleRecipeCheckBuilder.setAfter().setRecipe(tRecipe).build(); } } @@ -184,9 +213,8 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_En this.mEfficiencyIncrease = 10000; calculatePerfectOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; + // In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; if (this.mEUt > 0) { this.mEUt = (-this.mEUt); } @@ -214,9 +242,11 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_En public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasingAmount = 0; mCoilAmount = 0; - return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) && - mCasingAmount >= 8 && mCoilAmount == 1 && - !mEnergyHatches.isEmpty() && mMaintenanceHatches.size() == 1; + return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) + && mCasingAmount >= 8 + && mCoilAmount == 1 + && !mEnergyHatches.isEmpty() + && mMaintenanceHatches.size() == 1; } @Override @@ -253,7 +283,8 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_En @Override public boolean check(GT_MetaTileEntity_LargeChemicalReactor t, World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); - if (block instanceof IHeatingCoil && ((IHeatingCoil) block).getCoilHeat(world.getBlockMetadata(x, y, z)) != HeatingCoilLevel.None) { + if (block instanceof IHeatingCoil + && ((IHeatingCoil) block).getCoilHeat(world.getBlockMetadata(x, y, z)) != HeatingCoilLevel.None) { return t.mCoilAmount++ == 0; } else { return false; @@ -261,13 +292,15 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_En } @Override - public boolean spawnHint(GT_MetaTileEntity_LargeChemicalReactor t, World world, int x, int y, int z, ItemStack trigger) { + public boolean spawnHint( + GT_MetaTileEntity_LargeChemicalReactor t, World world, int x, int y, int z, ItemStack trigger) { StructureLibAPI.hintParticle(world, x, y, z, GregTech_API.sBlockCasings5, 0); return true; } @Override - public boolean placeBlock(GT_MetaTileEntity_LargeChemicalReactor t, World world, int x, int y, int z, ItemStack trigger) { + public boolean placeBlock( + GT_MetaTileEntity_LargeChemicalReactor t, World world, int x, int y, int z, ItemStack trigger) { if (t.mCoilAmount > 0) return false; boolean b = world.setBlock(x, y, z, GregTech_API.sBlockCasings5, 0, 3); if (b) t.mCoilAmount++; @@ -275,13 +308,23 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_En } @Override - public PlaceResult survivalPlaceBlock(GT_MetaTileEntity_LargeChemicalReactor t, World world, int x, int y, int z, ItemStack trigger, IItemSource s, EntityPlayerMP actor, Consumer<IChatComponent> chatter) { + public PlaceResult survivalPlaceBlock( + GT_MetaTileEntity_LargeChemicalReactor t, + World world, + int x, + int y, + int z, + ItemStack trigger, + IItemSource s, + EntityPlayerMP actor, + Consumer<IChatComponent> chatter) { if (t.mCoilAmount > 0) return PlaceResult.SKIP; - if (check(t, world, x, y,z)) return PlaceResult.SKIP; + if (check(t, world, x, y, z)) return PlaceResult.SKIP; if (!StructureLibAPI.isBlockTriviallyReplaceable(world, x, y, z, actor)) return PlaceResult.REJECT; ItemStack result = s.takeOne(ItemStackPredicate.from(GregTech_API.sBlockCasings5), true); if (result == null) return PlaceResult.REJECT; - PlaceResult ret = StructureUtility.survivalPlaceBlock(result, ItemStackPredicate.NBTMode.EXACT, null, true, world, x, y, z, s, actor, chatter); + PlaceResult ret = StructureUtility.survivalPlaceBlock( + result, ItemStackPredicate.NBTMode.EXACT, null, true, world, x, y, z, s, actor, chatter); if (ret == PlaceResult.ACCEPT) t.mCoilAmount++; return ret; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java index fcf87d8a34..3593e73d8d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java @@ -1,5 +1,11 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; + import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -13,6 +19,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynam import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; @@ -23,43 +30,49 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; - -public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_LargeTurbine> implements ISurvivalConstructable { +public abstract class GT_MetaTileEntity_LargeTurbine + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_LargeTurbine> + implements ISurvivalConstructable { private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeTurbine>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeTurbine>>() { - @Override - protected IStructureDefinition<GT_MetaTileEntity_LargeTurbine> computeValue(Class<?> type) { - return StructureDefinition.<GT_MetaTileEntity_LargeTurbine>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {" ", "xxxxx", "xxxxx", "xxxxx", "xxxxx",}, - {" --- ", "xcccx", "xhhhx", "xhhhx", "xhhhx",}, - {" --- ", "xc~cx", "xh-hx", "xh-hx", "xhdhx",}, - {" --- ", "xcccx", "xhhhx", "xhhhx", "xhhhx",}, - {" ", "xxxxx", "xxxxx", "xxxxx", "xxxxx",}, - })) - .addElement('c', lazy(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta()))) - .addElement('d', lazy(t -> Dynamo.newAny(t.getCasingTextureIndex(), 1))) - .addElement('h', lazy(t -> buildHatchAdder(GT_MetaTileEntity_LargeTurbine.class) - .atLeast(Maintenance, InputHatch, OutputHatch, OutputBus, InputBus, Muffler) - .casingIndex(t.getCasingTextureIndex()) - .dot(2) - .buildAndChain(t.getCasingBlock(), t.getCasingMeta()))) - .addElement('x', (IStructureElementCheckOnly<GT_MetaTileEntity_LargeTurbine>) (aContext, aWorld, aX, aY, aZ) -> { - TileEntity tTile = aWorld.getTileEntity(aX, aY, aZ); - return !(tTile instanceof IGregTechTileEntity) || !(((IGregTechTileEntity) tTile).getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine); - }) - .build(); - } - }; + private static final ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeTurbine>> STRUCTURE_DEFINITION = + new ClassValue<IStructureDefinition<GT_MetaTileEntity_LargeTurbine>>() { + @Override + protected IStructureDefinition<GT_MetaTileEntity_LargeTurbine> computeValue(Class<?> type) { + return StructureDefinition.<GT_MetaTileEntity_LargeTurbine>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + { + " ", "xxxxx", "xxxxx", "xxxxx", "xxxxx", + }, + { + " --- ", "xcccx", "xhhhx", "xhhhx", "xhhhx", + }, + { + " --- ", "xc~cx", "xh-hx", "xh-hx", "xhdhx", + }, + { + " --- ", "xcccx", "xhhhx", "xhhhx", "xhhhx", + }, + { + " ", "xxxxx", "xxxxx", "xxxxx", "xxxxx", + }, + })) + .addElement('c', lazy(t -> ofBlock(t.getCasingBlock(), t.getCasingMeta()))) + .addElement('d', lazy(t -> Dynamo.newAny(t.getCasingTextureIndex(), 1))) + .addElement('h', lazy(t -> buildHatchAdder(GT_MetaTileEntity_LargeTurbine.class) + .atLeast(Maintenance, InputHatch, OutputHatch, OutputBus, InputBus, Muffler) + .casingIndex(t.getCasingTextureIndex()) + .dot(2) + .buildAndChain(t.getCasingBlock(), t.getCasingMeta()))) + .addElement('x', (IStructureElementCheckOnly<GT_MetaTileEntity_LargeTurbine>) + (aContext, aWorld, aX, aY, aZ) -> { + TileEntity tTile = aWorld.getTileEntity(aX, aY, aZ); + return !(tTile instanceof IGregTechTileEntity) + || !(((IGregTechTileEntity) tTile).getMetaTileEntity() + instanceof GT_MetaTileEntity_LargeTurbine); + }) + .build(); + } + }; protected int baseEff = 0; protected int optFlow = 0; @@ -68,7 +81,7 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E protected int counter = 0; protected boolean looseFit = false; protected int overflowMultiplier = 0; - protected float[] flowMultipliers = new float[]{1, 1, 1}; + protected float[] flowMultipliers = new float[] {1, 1, 1}; public GT_MetaTileEntity_LargeTurbine(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -85,7 +98,8 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png"); } @Override @@ -95,7 +109,9 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - return checkPiece(STRUCTURE_PIECE_MAIN, 2, 2, 1) && mMaintenanceHatches.size() == 1 && mMufflerHatches.isEmpty() == (getPollutionPerTick(null) == 0); + return checkPiece(STRUCTURE_PIECE_MAIN, 2, 2, 1) + && mMaintenanceHatches.size() == 1 + && mMufflerHatches.isEmpty() == (getPollutionPerTick(null) == 0); } public abstract Block getCasingBlock(); @@ -106,7 +122,10 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E @Override public boolean addToMachineList(IGregTechTileEntity tTileEntity, int aBaseCasingIndex) { - return addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex()) || addInputToMachineList(tTileEntity, getCasingTextureIndex()) || addOutputToMachineList(tTileEntity, getCasingTextureIndex()) || addMufflerToMachineList(tTileEntity, getCasingTextureIndex()); + return addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex()) + || addInputToMachineList(tTileEntity, getCasingTextureIndex()) + || addOutputToMachineList(tTileEntity, getCasingTextureIndex()) + || addMufflerToMachineList(tTileEntity, getCasingTextureIndex()); } @Override @@ -121,19 +140,30 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E @Override public boolean checkRecipe(ItemStack aStack) { - if ((counter & 7) == 0 && (aStack == null || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) || aStack.getItemDamage() < 170 || aStack.getItemDamage() > 179)) { + if ((counter & 7) == 0 + && (aStack == null + || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) + || aStack.getItemDamage() < 170 + || aStack.getItemDamage() > 179)) { stopMachine(); return false; } ArrayList<FluidStack> tFluids = getStoredFluids(); if (tFluids.size() > 0) { - if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() + if (baseEff == 0 + || optFlow == 0 + || counter >= 512 + || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() || this.getBaseMetaTileEntity().hasInventoryBeenModified()) { counter = 0; - baseEff = GT_Utility.safeInt((long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F)); - optFlow = GT_Utility.safeInt((long) Math.max(Float.MIN_NORMAL, - ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier() + baseEff = GT_Utility.safeInt( + (long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F)); + optFlow = GT_Utility.safeInt((long) Math.max( + Float.MIN_NORMAL, + ((GT_MetaGenerated_Tool) aStack.getItem()) + .getToolStats(aStack) + .getSpeedMultiplier() * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed * 50)); @@ -143,8 +173,8 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E flowMultipliers[1] = GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mGasMultiplier; flowMultipliers[2] = GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mPlasmaMultiplier; - if(optFlow<=0 || baseEff<=0){ - stopMachine();//in case the turbine got removed + if (optFlow <= 0 || baseEff <= 0) { + stopMachine(); // in case the turbine got removed return false; } } else { @@ -152,23 +182,28 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E } } - int newPower = fluidIntoPower(tFluids, optFlow, baseEff, overflowMultiplier, flowMultipliers); // How much the turbine should be producing with this flow + int newPower = fluidIntoPower( + tFluids, + optFlow, + baseEff, + overflowMultiplier, + flowMultipliers); // How much the turbine should be producing with this flow int difference = newPower - this.mEUt; // difference between current output and new output - // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick) + // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in + // power level (per tick) // This is how much the turbine can actually change during this tick - int maxChangeAllowed = Math.max(10, GT_Utility.safeInt((long)Math.abs(difference)/100)); + int maxChangeAllowed = Math.max(10, GT_Utility.safeInt((long) Math.abs(difference) / 100)); if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative. this.mEUt += change; // Apply the change - } else - this.mEUt = newPower; + } else this.mEUt = newPower; if (this.mEUt <= 0) { - //stopMachine(); - this.mEUt=0; - this.mEfficiency=0; + // stopMachine(); + this.mEUt = 0; + this.mEfficiency = 0; return false; } else { this.mMaxProgresstime = 1; @@ -178,7 +213,8 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E } } - abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff, int overflowMultiplier, float[] flowMultipliers); + abstract int fluidIntoPower( + ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff, int overflowMultiplier, float[] flowMultipliers); abstract float getOverflowEfficiency(int totalFlow, int actualOptimalFlow, int overflowMultiplier); @@ -199,11 +235,9 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E int toolQualityLevel = GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolQuality; if (toolQualityLevel >= 6) { aOverflowMultiplier = 3; - } - else if (toolQualityLevel >= 3) { + } else if (toolQualityLevel >= 3) { aOverflowMultiplier = 2; - } - else { + } else { aOverflowMultiplier = 1; } return aOverflowMultiplier; @@ -232,58 +266,74 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_E @Override public String[] getInfoData() { - int mPollutionReduction=0; + int mPollutionReduction = 0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { if (isValidMetaTileEntity(tHatch)) { - mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction); + mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction); } } - String tRunning = mMaxProgresstime>0 ? - - EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.running.true")+EnumChatFormatting.RESET : - EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.running.false")+EnumChatFormatting.RESET; - String tMaintainance = getIdealStatus() == getRepairStatus() ? - EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET : - EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET ; + String tRunning = mMaxProgresstime > 0 + ? EnumChatFormatting.GREEN + + StatCollector.translateToLocal("GT5U.turbine.running.true") + + EnumChatFormatting.RESET + : EnumChatFormatting.RED + + StatCollector.translateToLocal("GT5U.turbine.running.false") + + EnumChatFormatting.RESET; + String tMaintainance = getIdealStatus() == getRepairStatus() + ? EnumChatFormatting.GREEN + + StatCollector.translateToLocal("GT5U.turbine.maintenance.false") + + EnumChatFormatting.RESET + : EnumChatFormatting.RED + + StatCollector.translateToLocal("GT5U.turbine.maintenance.true") + + EnumChatFormatting.RESET; int tDura = 0; if (mInventory[1] != null && mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { - tDura = GT_Utility.safeInt((long)(100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1]))+1)); + tDura = GT_Utility.safeInt((long) (100.0f + / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) + * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1])) + + 1)); } - long storedEnergy=0; - long maxEnergy=0; - for(GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + long storedEnergy = 0; + long maxEnergy = 0; + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { if (isValidMetaTileEntity(tHatch)) { - storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } } - String[] ret = new String[]{ - // 8 Lines available for information panels - tRunning + ": " + EnumChatFormatting.RED + GT_Utility.formatNumbers(mEUt) + EnumChatFormatting.RESET + " EU/t", /* 1 */ - tMaintainance, /* 2 */ - StatCollector.translateToLocal("GT5U.turbine.efficiency") + ": " + - EnumChatFormatting.YELLOW + (mEfficiency / 100F) + EnumChatFormatting.RESET + "%", /* 2 */ - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + /* 3 */ - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", - StatCollector.translateToLocal("GT5U.turbine.flow") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(GT_Utility.safeInt((long) realOptFlow)) + EnumChatFormatting.RESET + " L/t" + /* 4 */ - EnumChatFormatting.YELLOW + " (" + (looseFit ? StatCollector.translateToLocal("GT5U.turbine.loose") : StatCollector.translateToLocal("GT5U.turbine.tight")) + ")", /* 5 */ - StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " + - EnumChatFormatting.GOLD + GT_Utility.formatNumbers(storedFluid) + EnumChatFormatting.RESET + "L", /* 6 */ - StatCollector.translateToLocal("GT5U.turbine.dmg") + ": " + - EnumChatFormatting.RED + tDura + EnumChatFormatting.RESET + "%", /* 7 */ - StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + - EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %" /* 8 */ + String[] ret = new String[] { + // 8 Lines available for information panels + tRunning + ": " + EnumChatFormatting.RED + GT_Utility.formatNumbers(mEUt) + EnumChatFormatting.RESET + + " EU/t", /* 1 */ + tMaintainance, /* 2 */ + StatCollector.translateToLocal("GT5U.turbine.efficiency") + ": " + EnumChatFormatting.YELLOW + + (mEfficiency / 100F) + EnumChatFormatting.RESET + "%", /* 2 */ + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + /* 3 */ EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.turbine.flow") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(GT_Utility.safeInt((long) realOptFlow)) + EnumChatFormatting.RESET + + " L/t" + /* 4 */ EnumChatFormatting.YELLOW + + " (" + + (looseFit + ? StatCollector.translateToLocal("GT5U.turbine.loose") + : StatCollector.translateToLocal("GT5U.turbine.tight")) + + ")", /* 5 */ + StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " + EnumChatFormatting.GOLD + + GT_Utility.formatNumbers(storedFluid) + EnumChatFormatting.RESET + "L", /* 6 */ + StatCollector.translateToLocal("GT5U.turbine.dmg") + ": " + EnumChatFormatting.RED + tDura + + EnumChatFormatting.RESET + "%", /* 7 */ + StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + + mPollutionReduction + EnumChatFormatting.RESET + " %" /* 8 */ }; if (!this.getClass().getName().contains("Steam")) - ret[4] = StatCollector.translateToLocal("GT5U.turbine.flow") + ": " + EnumChatFormatting.YELLOW + GT_Utility.safeInt((long) realOptFlow) + EnumChatFormatting.RESET + " L/t"; + ret[4] = StatCollector.translateToLocal("GT5U.turbine.flow") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.safeInt((long) realOptFlow) + EnumChatFormatting.RESET + " L/t"; return ret; - - } public boolean hasTurbine() { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java index c16b7851fa..18f9ac884e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; @@ -10,14 +12,11 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeTurbine { public GT_MetaTileEntity_LargeTurbine_Gas(int aID, String aName, String aNameRegional) { @@ -29,11 +28,32 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide ? - (aActive ? TextureFactory.builder().addIcon(LARGETURBINE_SS_ACTIVE5).extFacing().build() : hasTurbine() ? TextureFactory.builder().addIcon(LARGETURBINE_SS5).extFacing().build() : TextureFactory.builder().addIcon(LARGETURBINE_SS_EMPTY5).extFacing().build()) - : casingTexturePages[0][58]}; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return new ITexture[] { + MACHINE_CASINGS[1][aColorIndex + 1], + aFacing == aSide + ? (aActive + ? TextureFactory.builder() + .addIcon(LARGETURBINE_SS_ACTIVE5) + .extFacing() + .build() + : hasTurbine() + ? TextureFactory.builder() + .addIcon(LARGETURBINE_SS5) + .extFacing() + .build() + : TextureFactory.builder() + .addIcon(LARGETURBINE_SS_EMPTY5) + .extFacing() + .build()) + : casingTexturePages[0][58] + }; } @Override @@ -44,7 +64,7 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT .addInfo("Needs a Turbine, place inside controller") .addInfo("Warning: Will be capped at 8192 EU/t in a future update") .addInfo("See the Advanced Large Gas Turbine as the next, uncapped, option") - //.addInfo("The excess fuel that gets consumed will be voided!") + // .addInfo("The excess fuel that gets consumed will be voided!") .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginStructureBlock(3, 3, 4, true) @@ -91,12 +111,19 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT } @Override - int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff, int overflowMultiplier, float[] flowMultipliers) { + int fluidIntoPower( + ArrayList<FluidStack> aFluids, + int aOptFlow, + int aBaseEff, + int overflowMultiplier, + float[] flowMultipliers) { if (aFluids.size() >= 1) { int tEU = 0; int actualOptimalFlow = 0; - FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest! + FluidStack firstFuelType = new FluidStack( + aFluids.get(0), + 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest! int fuelValue = getFuelValue(firstFuelType); if (aOptFlow < fuelValue) { @@ -113,8 +140,10 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT this.realOptFlow = actualOptimalFlow; // Allowed to use up to 450% optimal flow rate, depending on the value of overflowMultiplier. - // This value is chosen because the highest EU/t possible depends on the overflowMultiplier, and the formula used - // makes it so the flow rate for that max, per value of overflowMultiplier, is (percentage of optimal flow rate): + // This value is chosen because the highest EU/t possible depends on the overflowMultiplier, and the formula + // used + // makes it so the flow rate for that max, per value of overflowMultiplier, is (percentage of optimal flow + // rate): // - 150% if it is 1 // - 300% if it is 2 // - 450% if it is 3 @@ -144,19 +173,20 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L); } - // EU/t output cap to properly tier the LGT against the Advanced LGT, will be implemented in a future dev update + // EU/t output cap to properly tier the LGT against the Advanced LGT, will be implemented in a future dev + // update /*if (tEU > 8192) { tEU = 8192; }*/ - // If next output is above the maximum the dynamo can handle, set it to the maximum instead of exploding the turbine + // If next output is above the maximum the dynamo can handle, set it to the maximum instead of exploding the + // turbine // Raising the maximum allowed flow rate to account for the efficiency changes beyond the optimal flow // When the max fuel consumption rate was increased, turbines could explode on world load - if (tEU > getMaximumOutput()){ + if (tEU > getMaximumOutput()) { tEU = GT_Utility.safeInt(getMaximumOutput()); } return tEU; - } return 0; } @@ -164,19 +194,20 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT @Override float getOverflowEfficiency(int totalFlow, int actualOptimalFlow, int overflowMultiplier) { // overflowMultiplier changes how quickly the turbine loses efficiency after flow goes beyond the optimal value - // At the default value of 1, any flow will generate less EU/t than optimal flow, regardless of the amount of fuel used + // At the default value of 1, any flow will generate less EU/t than optimal flow, regardless of the amount of + // fuel used // The bigger this number is, the slower efficiency loss happens as flow moves beyond the optimal value // Gases are the second most efficient in this regard, with plasma being the most efficient float efficiency = 0; if (totalFlow > actualOptimalFlow) { - efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow)) / ((float) actualOptimalFlow * ((overflowMultiplier * 3) - 1)); - } - else { + efficiency = 1.0f + - Math.abs((totalFlow - actualOptimalFlow)) + / ((float) actualOptimalFlow * ((overflowMultiplier * 3) - 1)); + } else { efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); } return efficiency; } - } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_GasAdvanced.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_GasAdvanced.java index 244055ac61..9bc20e5f6e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_GasAdvanced.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_GasAdvanced.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; @@ -10,15 +12,11 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.items.GT_MetaGenerated_Tool.getPrimaryMaterial; - public class GT_MetaTileEntity_LargeTurbine_GasAdvanced extends GT_MetaTileEntity_LargeTurbine { public GT_MetaTileEntity_LargeTurbine_GasAdvanced(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -29,32 +27,53 @@ public class GT_MetaTileEntity_LargeTurbine_GasAdvanced extends GT_MetaTileEntit } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide ? - (aActive ? TextureFactory.builder().addIcon(LARGETURBINE_ADVGAS_ACTIVE5).extFacing().build() : hasTurbine() ? TextureFactory.builder().addIcon(LARGETURBINE_ADVGAS5).extFacing().build() : TextureFactory.builder().addIcon(LARGETURBINE_ADVGAS_EMPTY5).extFacing().build()) - : casingTexturePages[1][57]}; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return new ITexture[] { + MACHINE_CASINGS[1][aColorIndex + 1], + aFacing == aSide + ? (aActive + ? TextureFactory.builder() + .addIcon(LARGETURBINE_ADVGAS_ACTIVE5) + .extFacing() + .build() + : hasTurbine() + ? TextureFactory.builder() + .addIcon(LARGETURBINE_ADVGAS5) + .extFacing() + .build() + : TextureFactory.builder() + .addIcon(LARGETURBINE_ADVGAS_EMPTY5) + .extFacing() + .build()) + : casingTexturePages[1][57] + }; } @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Gas Turbine") - .addInfo("Warning: This is an experimental multiblock, subject to changes ") - .addInfo("Controller block for the Large Advanced Gas Turbine") - .addInfo("Needs a Turbine, place inside controller") - .addInfo("Only accepts gases above 800k EU/bucket") - .addInfo("Has no maximum EU/t output, only depends on the Dynamo Hatch") - .addPollutionAmount(getPollutionPerSecond(null)) - .addSeparator() - .beginStructureBlock(3, 3, 4, true) - .addController("Front center") - .addCasingInfo("Advanced Gas Turbine Casing", 24) - .addDynamoHatch("Back center", 1) - .addMaintenanceHatch("Side centered", 2) - .addMufflerHatch("Side centered", 2) - .addInputHatch("Gas Fuel, Side centered", 2) - .toolTipFinisher("Gregtech"); + .addInfo("Warning: This is an experimental multiblock, subject to changes ") + .addInfo("Controller block for the Large Advanced Gas Turbine") + .addInfo("Needs a Turbine, place inside controller") + .addInfo("Only accepts gases above 800k EU/bucket") + .addInfo("Has no maximum EU/t output, only depends on the Dynamo Hatch") + .addPollutionAmount(getPollutionPerSecond(null)) + .addSeparator() + .beginStructureBlock(3, 3, 4, true) + .addController("Front center") + .addCasingInfo("Advanced Gas Turbine Casing", 24) + .addDynamoHatch("Back center", 1) + .addMaintenanceHatch("Side centered", 2) + .addMufflerHatch("Side centered", 2) + .addInputHatch("Gas Fuel, Side centered", 2) + .toolTipFinisher("Gregtech"); return tt; } @@ -81,7 +100,9 @@ public class GT_MetaTileEntity_LargeTurbine_GasAdvanced extends GT_MetaTileEntit } @Override - public int getCasingTextureIndex() { return 185; } + public int getCasingTextureIndex() { + return 185; + } @Override public int getPollutionPerSecond(ItemStack aStack) { @@ -89,12 +110,19 @@ public class GT_MetaTileEntity_LargeTurbine_GasAdvanced extends GT_MetaTileEntit } @Override - int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff, int overflowMultiplier, float[] flowMultipliers) { + int fluidIntoPower( + ArrayList<FluidStack> aFluids, + int aOptFlow, + int aBaseEff, + int overflowMultiplier, + float[] flowMultipliers) { if (aFluids.size() >= 1) { int tEU = 0; int actualOptimalFlow = 0; - FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest! + FluidStack firstFuelType = new FluidStack( + aFluids.get(0), + 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest! int fuelValue = getFuelValue(firstFuelType); if (fuelValue < 100) { @@ -115,8 +143,10 @@ public class GT_MetaTileEntity_LargeTurbine_GasAdvanced extends GT_MetaTileEntit this.realOptFlow = actualOptimalFlow; // Allowed to use up to 450% optimal flow rate, depending on the value of overflowMultiplier. - // This value is chosen because the highest EU/t possible depends on the overflowMultiplier, and the formula used - // makes it so the flow rate for that max, per value of overflowMultiplier, is (percentage of optimal flow rate): + // This value is chosen because the highest EU/t possible depends on the overflowMultiplier, and the formula + // used + // makes it so the flow rate for that max, per value of overflowMultiplier, is (percentage of optimal flow + // rate): // - 150% if it is 1 // - 300% if it is 2 // - 450% if it is 3 @@ -146,14 +176,14 @@ public class GT_MetaTileEntity_LargeTurbine_GasAdvanced extends GT_MetaTileEntit tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L); } - // If next output is above the maximum the dynamo can handle, set it to the maximum instead of exploding the turbine + // If next output is above the maximum the dynamo can handle, set it to the maximum instead of exploding the + // turbine // Raising the maximum allowed flow rate to account for the efficiency changes beyond the optimal flow // When the max fuel consumption rate was increased, turbines could explode on world load - if (tEU > getMaximumOutput()){ + if (tEU > getMaximumOutput()) { tEU = GT_Utility.safeInt(getMaximumOutput()); } return tEU; - } return 0; } @@ -161,15 +191,17 @@ public class GT_MetaTileEntity_LargeTurbine_GasAdvanced extends GT_MetaTileEntit @Override float getOverflowEfficiency(int totalFlow, int actualOptimalFlow, int overflowMultiplier) { // overflowMultiplier changes how quickly the turbine loses efficiency after flow goes beyond the optimal value - // At the default value of 1, any flow will generate less EU/t than optimal flow, regardless of the amount of fuel used + // At the default value of 1, any flow will generate less EU/t than optimal flow, regardless of the amount of + // fuel used // The bigger this number is, the slower efficiency loss happens as flow moves beyond the optimal value // Gases are the second most efficient in this regard, with plasma being the most efficient float efficiency = 0; if (totalFlow > actualOptimalFlow) { - efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow)) / ((float) actualOptimalFlow * ((overflowMultiplier * 3) - 1)); - } - else { + efficiency = 1.0f + - Math.abs((totalFlow - actualOptimalFlow)) + / ((float) actualOptimalFlow * ((overflowMultiplier * 3) - 1)); + } else { efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java index 651bb36706..709a02af7c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java @@ -1,5 +1,9 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; +import static gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine_Steam.calculateLooseFlow; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; @@ -9,18 +13,13 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; -import static gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine_Steam.calculateLooseFlow; - public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_LargeTurbine { public boolean achievement = false; @@ -35,11 +34,32 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide ? - (aActive ? TextureFactory.builder().addIcon(LARGETURBINE_TI_ACTIVE5).extFacing().build() : hasTurbine() ? TextureFactory.builder().addIcon(LARGETURBINE_TI5).extFacing().build() : TextureFactory.builder().addIcon(LARGETURBINE_TI_EMPTY5).extFacing().build()) - : casingTexturePages[0][59]}; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return new ITexture[] { + MACHINE_CASINGS[1][aColorIndex + 1], + aFacing == aSide + ? (aActive + ? TextureFactory.builder() + .addIcon(LARGETURBINE_TI_ACTIVE5) + .extFacing() + .build() + : hasTurbine() + ? TextureFactory.builder() + .addIcon(LARGETURBINE_TI5) + .extFacing() + .build() + : TextureFactory.builder() + .addIcon(LARGETURBINE_TI_EMPTY5) + .extFacing() + .build()) + : casingTexturePages[0][59] + }; } @Override @@ -84,7 +104,12 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La } @Override - int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff, int overflowEfficiency, float[] flowMultipliers) { + int fluidIntoPower( + ArrayList<FluidStack> aFluids, + int aOptFlow, + int aBaseEff, + int overflowEfficiency, + float[] flowMultipliers) { if (looseFit) { long[] calculatedFlow = calculateLooseFlow(aOptFlow, aBaseEff); aOptFlow = GT_Utility.safeInt(calculatedFlow[0]); @@ -95,8 +120,10 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La int flow = 0; // Allowed to use up to 300% optimal flow rate, depending on the value of overflowMultiplier. - // This value is chosen because the highest EU/t possible depends on the overflowMultiplier, and the formula used - // makes it so the flow rate for that max, per value of overflowMultiplier, is (percentage of optimal flow rate): + // This value is chosen because the highest EU/t possible depends on the overflowMultiplier, and the formula + // used + // makes it so the flow rate for that max, per value of overflowMultiplier, is (percentage of optimal flow + // rate): // - 200% if it is 1 // - 250% if it is 2 // - 300% if it is 3 @@ -115,7 +142,12 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La totalFlow += flow; // track total input used if (!achievement) { try { - GT_Mod.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "efficientsteam"); + GT_Mod.achievements.issueAchievement( + this.getBaseMetaTileEntity() + .getWorld() + .getPlayerEntityByName( + this.getBaseMetaTileEntity().getOwnerName()), + "efficientsteam"); } catch (Exception ignored) { } achievement = true; @@ -135,9 +167,11 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La tEU = Math.max(1, GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L)); } - // If next output is above the maximum the dynamo can handle, set it to the maximum instead of exploding the turbine - // Raising the maximum allowed flow rate to account for the efficiency changes beyond the optimal flow rate can explode turbines on world load - if (tEU > getMaximumOutput()){ + // If next output is above the maximum the dynamo can handle, set it to the maximum instead of exploding the + // turbine + // Raising the maximum allowed flow rate to account for the efficiency changes beyond the optimal flow rate can + // explode turbines on world load + if (tEU > getMaximumOutput()) { tEU = GT_Utility.safeInt(getMaximumOutput()); } @@ -147,15 +181,18 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La @Override float getOverflowEfficiency(int totalFlow, int actualOptimalFlow, int overflowMultiplier) { // overflowMultiplier changes how quickly the turbine loses efficiency after flow goes beyond the optimal value - // At the default value of 1, any flow will generate less EU/t than optimal flow, regardless of the amount of fuel used + // At the default value of 1, any flow will generate less EU/t than optimal flow, regardless of the amount of + // fuel used // The bigger this number is, the slower efficiency loss happens as flow moves beyond the optimal value - // Superheated steam is the second least efficient out of all turbine fuels in this regard, with steam being the least efficient + // Superheated steam is the second least efficient out of all turbine fuels in this regard, with steam being the + // least efficient float efficiency = 0; if (totalFlow > actualOptimalFlow) { - efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow)) / ((float) actualOptimalFlow * (overflowMultiplier + 2)); - } - else { + efficiency = 1.0f + - Math.abs((totalFlow - actualOptimalFlow)) + / ((float) actualOptimalFlow * (overflowMultiplier + 2)); + } else { efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); } @@ -166,7 +203,11 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aSide == getBaseMetaTileEntity().getFrontFacing()) { looseFit ^= true; - GT_Utility.sendChatToPlayer(aPlayer, looseFit ? GT_Utility.trans("500", "Fitting: Loose - More Flow") : GT_Utility.trans("501", "Fitting: Tight - More Efficiency")); + GT_Utility.sendChatToPlayer( + aPlayer, + looseFit + ? GT_Utility.trans("500", "Fitting: Loose - More Flow") + : GT_Utility.trans("501", "Fitting: Tight - More Efficiency")); } } @@ -175,7 +216,6 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La return (looseFit && XSTR_INSTANCE.nextInt(4) == 0) ? 0 : 1; } - @Override public String[] getInfoData() { super.looseFit = looseFit; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java index 01bf9118ca..21e9572d20 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -13,6 +15,7 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -20,10 +23,6 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_LargeTurbine { public GT_MetaTileEntity_LargeTurbine_Plasma(int aID, String aName, String aNameRegional) { @@ -35,11 +34,32 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide ? - (aActive ? TextureFactory.builder().addIcon(LARGETURBINE_TU_ACTIVE5).extFacing().build() : hasTurbine() ? TextureFactory.builder().addIcon(LARGETURBINE_TU5).extFacing().build() : TextureFactory.builder().addIcon(LARGETURBINE_TU_EMPTY5).extFacing().build()) - : casingTexturePages[0][60]}; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return new ITexture[] { + MACHINE_CASINGS[1][aColorIndex + 1], + aFacing == aSide + ? (aActive + ? TextureFactory.builder() + .addIcon(LARGETURBINE_TU_ACTIVE5) + .extFacing() + .build() + : hasTurbine() + ? TextureFactory.builder() + .addIcon(LARGETURBINE_TU5) + .extFacing() + .build() + : TextureFactory.builder() + .addIcon(LARGETURBINE_TU_EMPTY5) + .extFacing() + .build()) + : casingTexturePages[0][60] + }; } @Override @@ -89,21 +109,31 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar } @Override - int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff, int overflowMultiplier, float[] flowMultipliers) { + int fluidIntoPower( + ArrayList<FluidStack> aFluids, + int aOptFlow, + int aBaseEff, + int overflowMultiplier, + float[] flowMultipliers) { if (aFluids.size() >= 1) { - aOptFlow *= 800;//CHANGED THINGS HERE, check recipe runs once per 20 ticks + aOptFlow *= 800; // CHANGED THINGS HERE, check recipe runs once per 20 ticks int tEU = 0; int actualOptimalFlow = 0; - FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest! + FluidStack firstFuelType = new FluidStack( + aFluids.get(0), + 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest! int fuelValue = getFuelValue(firstFuelType); - actualOptimalFlow = GT_Utility.safeInt((long) Math.ceil((double) aOptFlow * flowMultipliers[2] / (double) fuelValue)); + actualOptimalFlow = + GT_Utility.safeInt((long) Math.ceil((double) aOptFlow * flowMultipliers[2] / (double) fuelValue)); this.realOptFlow = actualOptimalFlow; // For scanner info // Allowed to use up to 550% optimal flow rate, depending on the value of overflowMultiplier. - // This value is chosen because the highest EU/t possible depends on the overflowMultiplier, and the formula used - // makes it so the flow rate for that max, per value of overflowMultiplier, is (percentage of optimal flow rate): + // This value is chosen because the highest EU/t possible depends on the overflowMultiplier, and the formula + // used + // makes it so the flow rate for that max, per value of overflowMultiplier, is (percentage of optimal flow + // rate): // - 250% if it is 1 // - 400% if it is 2 // - 550% if it is 3 @@ -137,7 +167,7 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar if (totalFlow <= 0) return 0; tEU = GT_Utility.safeInt((long) ((fuelValue / 20D) * (double) totalFlow)); - //GT_FML_LOGGER.info(totalFlow+" : "+fuelValue+" : "+aOptFlow+" : "+actualOptimalFlow+" : "+tEU); + // GT_FML_LOGGER.info(totalFlow+" : "+fuelValue+" : "+aOptFlow+" : "+actualOptimalFlow+" : "+tEU); if (totalFlow == actualOptimalFlow) { tEU = GT_Utility.safeInt((long) (aBaseEff / 10000D * tEU)); @@ -147,14 +177,15 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar tEU = GT_Utility.safeInt((long) (aBaseEff / 10000D * tEU)); } - // If next output is above the maximum the dynamo can handle, set it to the maximum instead of exploding the turbine - // Raising the maximum allowed flow rate to account for the efficiency changes beyond the optimal flow rate can explode turbines on world load - if (tEU > getMaximumOutput()){ + // If next output is above the maximum the dynamo can handle, set it to the maximum instead of exploding the + // turbine + // Raising the maximum allowed flow rate to account for the efficiency changes beyond the optimal flow rate + // can explode turbines on world load + if (tEU > getMaximumOutput()) { tEU = GT_Utility.safeInt(getMaximumOutput()); } return tEU; - } return 0; } @@ -162,15 +193,17 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar @Override float getOverflowEfficiency(int totalFlow, int actualOptimalFlow, int overflowMultiplier) { // overflowMultiplier changes how quickly the turbine loses efficiency after flow goes beyond the optimal value - // At the default value of 1, any flow will generate less EU/t than optimal flow, regardless of the amount of fuel used + // At the default value of 1, any flow will generate less EU/t than optimal flow, regardless of the amount of + // fuel used // The bigger this number is, the slower efficiency loss happens as flow moves beyond the optimal value // Plasmas are the most efficient out of all turbine fuels in this regard float efficiency = 0; if (totalFlow > actualOptimalFlow) { - efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow)) / ((float) actualOptimalFlow * ((overflowMultiplier * 3) + 1)); - } - else { + efficiency = 1.0f + - Math.abs((totalFlow - actualOptimalFlow)) + / ((float) actualOptimalFlow * ((overflowMultiplier * 3) + 1)); + } else { efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); } @@ -179,18 +212,29 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar @Override public boolean checkRecipe(ItemStack aStack) { - if ((counter & 7) == 0 && (aStack == null || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) || aStack.getItemDamage() < 170 || aStack.getItemDamage() > 179)) { + if ((counter & 7) == 0 + && (aStack == null + || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) + || aStack.getItemDamage() < 170 + || aStack.getItemDamage() > 179)) { stopMachine(); return false; } ArrayList<FluidStack> tFluids = getStoredFluids(); if (!tFluids.isEmpty()) { - if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() + if (baseEff == 0 + || optFlow == 0 + || counter >= 512 + || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() || this.getBaseMetaTileEntity().hasInventoryBeenModified()) { counter = 0; - baseEff = GT_Utility.safeInt((long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F)); - optFlow = GT_Utility.safeInt((long) Math.max(Float.MIN_NORMAL, - ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier() + baseEff = GT_Utility.safeInt( + (long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F)); + optFlow = GT_Utility.safeInt((long) Math.max( + Float.MIN_NORMAL, + ((GT_MetaGenerated_Tool) aStack.getItem()) + .getToolStats(aStack) + .getSpeedMultiplier() * ((GT_MetaGenerated_Tool) aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed * 50)); overflowMultiplier = getOverflowMultiplier(aStack); @@ -200,26 +244,31 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar } if (optFlow <= 0 || baseEff <= 0) { - stopMachine();//in case the turbine got removed + stopMachine(); // in case the turbine got removed return false; } - int newPower = fluidIntoPower(tFluids, optFlow, baseEff, overflowMultiplier, flowMultipliers); // How much the turbine should be producing with this flow + int newPower = fluidIntoPower( + tFluids, + optFlow, + baseEff, + overflowMultiplier, + flowMultipliers); // How much the turbine should be producing with this flow int difference = newPower - this.mEUt; // difference between current output and new output - // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick) + // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in + // power level (per tick) // This is how much the turbine can actually change during this tick int maxChangeAllowed = Math.max(200, GT_Utility.safeInt((long) Math.abs(difference) / 5)); if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative. this.mEUt += change; // Apply the change - } else - this.mEUt = newPower; + } else this.mEUt = newPower; if (this.mEUt <= 0) { - //stopMachine(); + // stopMachine(); this.mEUt = 0; this.mEfficiency = 0; return false; @@ -232,57 +281,75 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar } } - @Override + @Override public String[] getInfoData() { - int mPollutionReduction=0; + int mPollutionReduction = 0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { if (isValidMetaTileEntity(tHatch)) { - mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction); + mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction); } } - String tRunning = mMaxProgresstime>0 ? - - EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.running.true")+EnumChatFormatting.RESET : - EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.running.false")+EnumChatFormatting.RESET; - String tMaintainance = getIdealStatus() == getRepairStatus() ? - EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET : - EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET ; + String tRunning = mMaxProgresstime > 0 + ? EnumChatFormatting.GREEN + + StatCollector.translateToLocal("GT5U.turbine.running.true") + + EnumChatFormatting.RESET + : EnumChatFormatting.RED + + StatCollector.translateToLocal("GT5U.turbine.running.false") + + EnumChatFormatting.RESET; + String tMaintainance = getIdealStatus() == getRepairStatus() + ? EnumChatFormatting.GREEN + + StatCollector.translateToLocal("GT5U.turbine.maintenance.false") + + EnumChatFormatting.RESET + : EnumChatFormatting.RED + + StatCollector.translateToLocal("GT5U.turbine.maintenance.true") + + EnumChatFormatting.RESET; int tDura = 0; if (mInventory[1] != null && mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { - tDura = GT_Utility.safeInt((long)(100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1]))+1)); + tDura = GT_Utility.safeInt((long) (100.0f + / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) + * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1])) + + 1)); } - long storedEnergy=0; - long maxEnergy=0; - for(GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + long storedEnergy = 0; + long maxEnergy = 0; + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { if (isValidMetaTileEntity(tHatch)) { - storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } } - String[] ret = new String[]{ - // 8 Lines available for information panels - tRunning + ": " + EnumChatFormatting.RED + GT_Utility.formatNumbers(mEUt) + EnumChatFormatting.RESET + " EU/t", /* 1 */ - tMaintainance, /* 2 */ - StatCollector.translateToLocal("GT5U.turbine.efficiency") + ": " + - EnumChatFormatting.YELLOW + (mEfficiency/100F) + EnumChatFormatting.RESET + "%", /* 2 */ - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + /* 3 */ - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", - StatCollector.translateToLocal("GT5U.turbine.flow") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(GT_Utility.safeInt((long)realOptFlow)) + EnumChatFormatting.RESET + " L/s" + /* 4 */ - EnumChatFormatting.YELLOW + " (" + (looseFit?StatCollector.translateToLocal("GT5U.turbine.loose"):StatCollector.translateToLocal("GT5U.turbine.tight")) + ")", /* 5 */ - StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " + - EnumChatFormatting.GOLD + GT_Utility.formatNumbers(storedFluid) + EnumChatFormatting.RESET + "L", /* 6 */ - StatCollector.translateToLocal("GT5U.turbine.dmg") + ": " + - EnumChatFormatting.RED + Integer.toString(tDura) + EnumChatFormatting.RESET + "%", /* 7 */ - StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + - EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %" /* 8 */ + String[] ret = new String[] { + // 8 Lines available for information panels + tRunning + ": " + EnumChatFormatting.RED + GT_Utility.formatNumbers(mEUt) + EnumChatFormatting.RESET + + " EU/t", /* 1 */ + tMaintainance, /* 2 */ + StatCollector.translateToLocal("GT5U.turbine.efficiency") + ": " + EnumChatFormatting.YELLOW + + (mEfficiency / 100F) + EnumChatFormatting.RESET + "%", /* 2 */ + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + /* 3 */ EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.turbine.flow") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(GT_Utility.safeInt((long) realOptFlow)) + EnumChatFormatting.RESET + + " L/s" + /* 4 */ EnumChatFormatting.YELLOW + + " (" + + (looseFit + ? StatCollector.translateToLocal("GT5U.turbine.loose") + : StatCollector.translateToLocal("GT5U.turbine.tight")) + + ")", /* 5 */ + StatCollector.translateToLocal("GT5U.turbine.fuel") + ": " + EnumChatFormatting.GOLD + + GT_Utility.formatNumbers(storedFluid) + EnumChatFormatting.RESET + "L", /* 6 */ + StatCollector.translateToLocal("GT5U.turbine.dmg") + ": " + EnumChatFormatting.RED + Integer.toString(tDura) + + EnumChatFormatting.RESET + "%", /* 7 */ + StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + + mPollutionReduction + EnumChatFormatting.RESET + " %" /* 8 */ }; if (!this.getClass().getName().contains("Steam")) - ret[4]=StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+GT_Utility.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/s"; + ret[4] = StatCollector.translateToLocal("GT5U.turbine.flow") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.safeInt((long) realOptFlow) + EnumChatFormatting.RESET + " L/s"; return ret; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java index 9da596b6e6..3d17b25399 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java @@ -1,5 +1,9 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.GT_Values.STEAM_PER_WATER; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; @@ -9,18 +13,13 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; - -import static gregtech.api.enums.GT_Values.STEAM_PER_WATER; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_LargeTurbine { private int excessWater; @@ -31,17 +30,37 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg super(aID, aName, aNameRegional); } - public GT_MetaTileEntity_LargeTurbine_Steam(String aName) { super(aName); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide ? - (aActive ? TextureFactory.builder().addIcon(LARGETURBINE_ST_ACTIVE5).extFacing().build() : hasTurbine() ? TextureFactory.builder().addIcon(LARGETURBINE_ST5).extFacing().build() : TextureFactory.builder().addIcon(LARGETURBINE_ST_EMPTY5).extFacing().build()) - : casingTexturePages[0][57]}; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return new ITexture[] { + MACHINE_CASINGS[1][aColorIndex + 1], + aFacing == aSide + ? (aActive + ? TextureFactory.builder() + .addIcon(LARGETURBINE_ST_ACTIVE5) + .extFacing() + .build() + : hasTurbine() + ? TextureFactory.builder() + .addIcon(LARGETURBINE_ST5) + .extFacing() + .build() + : TextureFactory.builder() + .addIcon(LARGETURBINE_ST_EMPTY5) + .extFacing() + .build()) + : casingTexturePages[0][57] + }; } @Override @@ -93,7 +112,12 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg } @Override - int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff, int overflowEfficiency, float[] flowMultipliers) { + int fluidIntoPower( + ArrayList<FluidStack> aFluids, + int aOptFlow, + int aBaseEff, + int overflowEfficiency, + float[] flowMultipliers) { if (looseFit) { long[] calculatedFlow = calculateLooseFlow(aOptFlow, aBaseEff); aOptFlow = GT_Utility.safeInt(calculatedFlow[0]); @@ -104,8 +128,10 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg int flow = 0; // Allowed to use up to 250% optimal flow rate, depending on the value of overflowMultiplier. - // This value is chosen because the highest EU/t possible depends on the overflowMultiplier, and the formula used - // makes it so the flow rate for that max, per value of overflowMultiplier, is (percentage of optimal flow rate): + // This value is chosen because the highest EU/t possible depends on the overflowMultiplier, and the formula + // used + // makes it so the flow rate for that max, per value of overflowMultiplier, is (percentage of optimal flow + // rate): // - 150% if it is 1 // - 200% if it is 2 // - 250% if it is 3 @@ -114,7 +140,9 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg this.realOptFlow = aOptFlow * flowMultipliers[0]; storedFluid = 0; - for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) { // loop through each hatch; extract inputs and track totals. + for (int i = 0; + i < aFluids.size() && remainingFlow > 0; + i++) { // loop through each hatch; extract inputs and track totals. final FluidStack aFluidStack = aFluids.get(i); if (GT_ModHandler.isAnySteam(aFluidStack)) { flow = Math.min(aFluidStack.amount, remainingFlow); // try to use up to the max flow defined just above @@ -123,7 +151,12 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches totalFlow += flow; // track total input used if (!achievement) { - GT_Mod.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "muchsteam"); + GT_Mod.achievements.issueAchievement( + this.getBaseMetaTileEntity() + .getWorld() + .getPlayerEntityByName( + this.getBaseMetaTileEntity().getOwnerName()), + "muchsteam"); achievement = true; } } else if (GT_ModHandler.isSuperHeatedSteam(aFluidStack)) { @@ -142,9 +175,11 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg tEU = Math.max(1, GT_Utility.safeInt((long) tEU * (long) aBaseEff / 20000L)); } - // If next output is above the maximum the dynamo can handle, set it to the maximum instead of exploding the turbine - // Raising the maximum allowed flow rate to account for the efficiency changes beyond the optimal flow rate can explode turbines on world load - if (tEU > getMaximumOutput()){ + // If next output is above the maximum the dynamo can handle, set it to the maximum instead of exploding the + // turbine + // Raising the maximum allowed flow rate to account for the efficiency changes beyond the optimal flow rate can + // explode turbines on world load + if (tEU > getMaximumOutput()) { tEU = GT_Utility.safeInt(getMaximumOutput()); } @@ -154,15 +189,17 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg @Override float getOverflowEfficiency(int totalFlow, int actualOptimalFlow, int overflowMultiplier) { // overflowMultiplier changes how quickly the turbine loses efficiency after flow goes beyond the optimal value - // At the default value of 1, any flow will generate less EU/t than optimal flow, regardless of the amount of fuel used + // At the default value of 1, any flow will generate less EU/t than optimal flow, regardless of the amount of + // fuel used // The bigger this number is, the slower efficiency loss happens as flow moves beyond the optimal value // Steam is the least efficient out of all turbine fuels in this regard float efficiency = 0; if (totalFlow > actualOptimalFlow) { - efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow)) / ((float) actualOptimalFlow * (overflowMultiplier + 1)); - } - else { + efficiency = 1.0f + - Math.abs((totalFlow - actualOptimalFlow)) + / ((float) actualOptimalFlow * (overflowMultiplier + 1)); + } else { efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); } @@ -171,29 +208,29 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg public static long[] calculateLooseFlow(int aOptFlow, int aBaseEff) { aOptFlow *= 4; - if(aBaseEff>=26000) { + if (aBaseEff >= 26000) { aOptFlow *= Math.pow(1.1f, ((aBaseEff - 8000) / 10000F) * 20f); aBaseEff *= 0.6f; - }else if(aBaseEff>22000) { + } else if (aBaseEff > 22000) { aOptFlow *= Math.pow(1.1f, ((aBaseEff - 7000) / 10000F) * 20f); aBaseEff *= 0.65f; - }else if(aBaseEff>18000) { + } else if (aBaseEff > 18000) { aOptFlow *= Math.pow(1.1f, ((aBaseEff - 6000) / 10000F) * 20f); aBaseEff *= 0.70f; - }else if(aBaseEff>14000) { + } else if (aBaseEff > 14000) { aOptFlow *= Math.pow(1.1f, ((aBaseEff - 5000) / 10000F) * 20f); aBaseEff *= 0.75f; - }else if(aBaseEff>10000) { + } else if (aBaseEff > 10000) { aOptFlow *= Math.pow(1.1f, ((aBaseEff - 4000) / 10000F) * 20f); aBaseEff *= 0.8f; - }else if(aBaseEff>6000) { + } else if (aBaseEff > 6000) { aOptFlow *= Math.pow(1.1f, ((aBaseEff - 3000) / 10000F) * 20f); aBaseEff *= 0.85f; - }else{ + } else { aBaseEff *= 0.9f; } - if (aBaseEff % 100 != 0){ + if (aBaseEff % 100 != 0) { aBaseEff -= aBaseEff % 100; } @@ -207,7 +244,11 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aSide == getBaseMetaTileEntity().getFrontFacing()) { looseFit ^= true; - GT_Utility.sendChatToPlayer(aPlayer, looseFit ? GT_Utility.trans("500", "Fitting: Loose - More Flow") : GT_Utility.trans("501", "Fitting: Tight - More Efficiency")); + GT_Utility.sendChatToPlayer( + aPlayer, + looseFit + ? GT_Utility.trans("500", "Fitting: Loose - More Flow") + : GT_Utility.trans("501", "Fitting: Tight - More Efficiency")); } } @@ -216,7 +257,6 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg return (looseFit && XSTR_INSTANCE.nextInt(4) == 0) ? 0 : 1; } - @Override public String[] getInfoData() { super.looseFit = looseFit; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java index b0de2803b3..7d3b341786 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java @@ -1,5 +1,16 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.GT_Values.VN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; + import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -22,6 +33,7 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_StructureUtility; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -29,43 +41,40 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -import java.util.ArrayList; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.GT_Values.VN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; - -public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMultiFurnace<GT_MetaTileEntity_MultiFurnace> implements ISurvivalConstructable { +public class GT_MetaTileEntity_MultiFurnace + extends GT_MetaTileEntity_AbstractMultiFurnace<GT_MetaTileEntity_MultiFurnace> + implements ISurvivalConstructable { private int mLevel = 0; private int mCostDiscount = 1; private static final int CASING_INDEX = 11; private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GT_MetaTileEntity_MultiFurnace> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_MultiFurnace>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {"ccc", "cmc", "ccc"}, - {"CCC", "C-C", "CCC",}, - {"b~b", "bbb", "bbb"} - })) - .addElement('c', ofBlock(GregTech_API.sBlockCasings1, CASING_INDEX)) - .addElement('m', Muffler.newAny(CASING_INDEX, 2)) - .addElement('C', GT_StructureUtility.ofCoil(GT_MetaTileEntity_MultiFurnace::setCoilLevel, GT_MetaTileEntity_MultiFurnace::getCoilLevel)) - .addElement('b', ofChain( - GT_StructureUtility.<GT_MetaTileEntity_MultiFurnace>buildHatchAdder() - .atLeast(Maintenance, InputBus, OutputBus, Energy) - .casingIndex(CASING_INDEX) - .dot(1) - .build(), - ofBlock(GregTech_API.sBlockCasings1, CASING_INDEX) - )) - .build(); + private static final IStructureDefinition<GT_MetaTileEntity_MultiFurnace> STRUCTURE_DEFINITION = + StructureDefinition.<GT_MetaTileEntity_MultiFurnace>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {"ccc", "cmc", "ccc"}, + { + "CCC", "C-C", "CCC", + }, + {"b~b", "bbb", "bbb"} + })) + .addElement('c', ofBlock(GregTech_API.sBlockCasings1, CASING_INDEX)) + .addElement('m', Muffler.newAny(CASING_INDEX, 2)) + .addElement( + 'C', + GT_StructureUtility.ofCoil( + GT_MetaTileEntity_MultiFurnace::setCoilLevel, + GT_MetaTileEntity_MultiFurnace::getCoilLevel)) + .addElement( + 'b', + ofChain( + GT_StructureUtility.<GT_MetaTileEntity_MultiFurnace>buildHatchAdder() + .atLeast(Maintenance, InputBus, OutputBus, Energy) + .casingIndex(CASING_INDEX) + .dot(1) + .build(), + ofBlock(GregTech_API.sBlockCasings1, CASING_INDEX))) + .build(); public GT_MetaTileEntity_MultiFurnace(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -103,21 +112,45 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide != aFacing) return new ITexture[]{casingTexturePages[0][CASING_INDEX]}; - if (aActive) return new ITexture[]{ - casingTexturePages[0][CASING_INDEX], - TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + if (aSide != aFacing) return new ITexture[] {casingTexturePages[0][CASING_INDEX]}; + if (aActive) + return new ITexture[] { casingTexturePages[0][CASING_INDEX], - TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + casingTexturePages[0][CASING_INDEX], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_MULTI_SMELTER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_MULTI_SMELTER_GLOW) + .extFacing() + .glow() + .build() + }; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png"); } @Override @@ -126,15 +159,14 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu } @Override - public int getPollutionPerSecond(ItemStack aStack){ + public int getPollutionPerSecond(ItemStack aStack) { return GT_Mod.gregtechproxy.mPollutionMultiSmelterPerSecond; } @Override public boolean checkRecipe(ItemStack aStack) { ArrayList<ItemStack> tInputList = getStoredInputs(); - if (tInputList.isEmpty()) - return false; + if (tInputList.isEmpty()) return false; int mVolatage = GT_Utility.safeInt(getMaxInputVoltage()); int tMaxParrallel = 8 * this.mLevel; @@ -171,16 +203,13 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; calculateOverclockedNessMulti(4, 512, 1, mVolatage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; + // In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; - this.mEUt = GT_Utility.safeInt(((long)mEUt) * this.mLevel / (long)this.mCostDiscount,1); - if (mEUt == Integer.MAX_VALUE - 1) - return false; + this.mEUt = GT_Utility.safeInt(((long) mEUt) * this.mLevel / (long) this.mCostDiscount, 1); + if (mEUt == Integer.MAX_VALUE - 1) return false; - if (this.mEUt > 0) - this.mEUt = (-this.mEUt); + if (this.mEUt > 0) this.mEUt = (-this.mEUt); } updateSlots(); return true; @@ -192,7 +221,7 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){ + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { this.mLevel = 0; this.mCostDiscount = 1; @@ -200,14 +229,11 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu setCoilLevel(HeatingCoilLevel.None); - if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 2, 0)) - return false; + if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 2, 0)) return false; - if (getCoilLevel() == HeatingCoilLevel.None) - return false; + if (getCoilLevel() == HeatingCoilLevel.None) return false; - if (mMaintenanceHatches.size() != 1) - return false; + if (mMaintenanceHatches.size() != 1) return false; this.mLevel = getCoilLevel().getLevel(); this.mCostDiscount = getCoilLevel().getCostDiscount(); @@ -225,49 +251,56 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) { if ((xPos == tX) && (zPos == tZ)) continue; tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, tY + 1, zPos); - if (tUsedMeta >= 12 && tUsedMeta <= 14 && aBaseMetaTileEntity.getBlock(xPos, tY + 1, zPos) == GregTech_API.sBlockCasings1) - aBaseMetaTileEntity.getWorld().setBlock(xPos, tY + 1, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3); + if (tUsedMeta >= 12 + && tUsedMeta <= 14 + && aBaseMetaTileEntity.getBlock(xPos, tY + 1, zPos) == GregTech_API.sBlockCasings1) + aBaseMetaTileEntity + .getWorld() + .setBlock(xPos, tY + 1, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3); } } - @Override public String[] getInfoData() { - int mPollutionReduction=0; + int mPollutionReduction = 0; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) if (isValidMetaTileEntity(tHatch)) mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction); - long storedEnergy=0; - long maxEnergy=0; - for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + long storedEnergy = 0; + long maxEnergy = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) if (isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } - return new String[]{ - StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", - StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " + - StatCollector.translateToLocal("GT5U.machines.tier") + ": " + - EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + - EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + - StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " + - EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - StatCollector.translateToLocal("GT5U.MS.multismelting") + ": " + - EnumChatFormatting.GREEN + mLevel * 8 + EnumChatFormatting.RESET + - " Discount: (EU/t) / " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mCostDiscount) + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + - EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %" + return new String[] { + StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " + + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + EnumChatFormatting.YELLOW + + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + EnumChatFormatting.YELLOW + + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + StatCollector.translateToLocal("GT5U.MS.multismelting") + ": " + EnumChatFormatting.GREEN + + mLevel * 8 + EnumChatFormatting.RESET + " Discount: (EU/t) / " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mCostDiscount) + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + + mPollutionReduction + EnumChatFormatting.RESET + " %" }; } @@ -280,10 +313,10 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu if (aTileEntity == null) return false; IMetaTileEntity tMTE = aTileEntity.getMetaTileEntity(); if (tMTE == null) return false; - return tMTE instanceof GT_MetaTileEntity_Hatch_Energy || - tMTE instanceof GT_MetaTileEntity_Hatch_InputBus || - tMTE instanceof GT_MetaTileEntity_Hatch_OutputBus || - tMTE instanceof GT_MetaTileEntity_Hatch_Maintenance; + return tMTE instanceof GT_MetaTileEntity_Hatch_Energy + || tMTE instanceof GT_MetaTileEntity_Hatch_InputBus + || tMTE instanceof GT_MetaTileEntity_Hatch_OutputBus + || tMTE instanceof GT_MetaTileEntity_Hatch_Maintenance; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java index fe91d2cf81..dacf503128 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java @@ -1,5 +1,17 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GT_StructureUtility.ofCoil; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; + import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -17,56 +29,67 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.List; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; -import static gregtech.api.util.GT_StructureUtility.ofCoil; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_OilCracker> implements ISurvivalConstructable { +public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_OilCracker> + implements ISurvivalConstructable { private static final byte CASING_INDEX = 49; private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GT_MetaTileEntity_OilCracker> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_OilCracker>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {"lcmcr", "lcmcr", "lcmcr"}, - {"lc~cr", "l---r", "lcmcr"}, - {"lcmcr", "lcmcr", "lcmcr"}, - })) - .addElement('c', ofCoil(GT_MetaTileEntity_OilCracker::setCoilLevel, GT_MetaTileEntity_OilCracker::getCoilLevel)) - .addElement('l', ofChain( // TODO figure out what to do with this - ofHatchAdder(GT_MetaTileEntity_OilCracker::addLeftHatchToMachineList, CASING_INDEX, 2), - ofHatchAdder(GT_MetaTileEntity_OilCracker::addEnergyInputToMachineList, CASING_INDEX, 1), - ofHatchAdder(GT_MetaTileEntity_OilCracker::addMaintenanceToMachineList, CASING_INDEX, 1), - onElementPass(GT_MetaTileEntity_OilCracker::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, 1)) - )) - .addElement('r', ofChain( - ofHatchAdder(GT_MetaTileEntity_OilCracker::addRightHatchToMachineList, CASING_INDEX, 3), - ofHatchAdder(GT_MetaTileEntity_OilCracker::addEnergyInputToMachineList, CASING_INDEX, 1), - ofHatchAdder(GT_MetaTileEntity_OilCracker::addMaintenanceToMachineList, CASING_INDEX, 1), - onElementPass(GT_MetaTileEntity_OilCracker::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, 1)) - )) - .addElement('m', ofChain( - ofHatchAdder(GT_MetaTileEntity_OilCracker::addMiddleInputToMachineList, CASING_INDEX, 1), - ofHatchAdder(GT_MetaTileEntity_OilCracker::addEnergyInputToMachineList, CASING_INDEX, 1), - ofHatchAdder(GT_MetaTileEntity_OilCracker::addMaintenanceToMachineList, CASING_INDEX, 1), - onElementPass(GT_MetaTileEntity_OilCracker::onCasingAdded, ofBlock(GregTech_API.sBlockCasings4, 1)) - )) - .build(); + private static final IStructureDefinition<GT_MetaTileEntity_OilCracker> STRUCTURE_DEFINITION = + StructureDefinition.<GT_MetaTileEntity_OilCracker>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {"lcmcr", "lcmcr", "lcmcr"}, + {"lc~cr", "l---r", "lcmcr"}, + {"lcmcr", "lcmcr", "lcmcr"}, + })) + .addElement( + 'c', + ofCoil( + GT_MetaTileEntity_OilCracker::setCoilLevel, + GT_MetaTileEntity_OilCracker::getCoilLevel)) + .addElement( + 'l', + ofChain( // TODO figure out what to do with this + ofHatchAdder( + GT_MetaTileEntity_OilCracker::addLeftHatchToMachineList, CASING_INDEX, 2), + ofHatchAdder( + GT_MetaTileEntity_OilCracker::addEnergyInputToMachineList, CASING_INDEX, 1), + ofHatchAdder( + GT_MetaTileEntity_OilCracker::addMaintenanceToMachineList, CASING_INDEX, 1), + onElementPass( + GT_MetaTileEntity_OilCracker::onCasingAdded, + ofBlock(GregTech_API.sBlockCasings4, 1)))) + .addElement( + 'r', + ofChain( + ofHatchAdder( + GT_MetaTileEntity_OilCracker::addRightHatchToMachineList, CASING_INDEX, 3), + ofHatchAdder( + GT_MetaTileEntity_OilCracker::addEnergyInputToMachineList, CASING_INDEX, 1), + ofHatchAdder( + GT_MetaTileEntity_OilCracker::addMaintenanceToMachineList, CASING_INDEX, 1), + onElementPass( + GT_MetaTileEntity_OilCracker::onCasingAdded, + ofBlock(GregTech_API.sBlockCasings4, 1)))) + .addElement( + 'm', + ofChain( + ofHatchAdder( + GT_MetaTileEntity_OilCracker::addMiddleInputToMachineList, CASING_INDEX, 1), + ofHatchAdder( + GT_MetaTileEntity_OilCracker::addEnergyInputToMachineList, CASING_INDEX, 1), + ofHatchAdder( + GT_MetaTileEntity_OilCracker::addMaintenanceToMachineList, CASING_INDEX, 1), + onElementPass( + GT_MetaTileEntity_OilCracker::onCasingAdded, + ofBlock(GregTech_API.sBlockCasings4, 1)))) + .build(); private HeatingCoilLevel heatLevel; protected final List<GT_MetaTileEntity_Hatch_Input> mMiddleInputHatches = new ArrayList<>(); // 0 -> left, 1 -> right, any other -> not found @@ -103,7 +126,7 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult .addEnergyHatch("Any casing", 1) .addMaintenanceHatch("Any casing", 1) .addInputHatch("Steam/Hydrogen ONLY, Any middle ring casing", 1) - .addInputHatch("Any left/right side casing",2, 3) + .addInputHatch("Any left/right side casing", 2, 3) .addOutputHatch("Any right/left side casing", 2, 3) .addStructureInfo("Input/Output Hatches must be on opposite sides!") .addStructureHint("GT5U.cracker.io_side") @@ -112,21 +135,47 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { - if (aActive) return new ITexture[]{casingTexturePages[0][CASING_INDEX], - TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{casingTexturePages[0][CASING_INDEX], - TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW).extFacing().glow().build()}; + if (aActive) + return new ITexture[] { + casingTexturePages[0][CASING_INDEX], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + casingTexturePages[0][CASING_INDEX], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{casingTexturePages[0][CASING_INDEX]}; + return new ITexture[] {casingTexturePages[0][CASING_INDEX]}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OilCrackingUnit.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OilCrackingUnit.png"); } @Override @@ -141,37 +190,33 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = getRecipeMap().findRecipe( - getBaseMetaTileEntity(), - false, - gregtech.api.enums.GT_Values.V[tTier], - tFluidInputs, - mInventory[1] - ); + GT_Recipe tRecipe = getRecipeMap() + .findRecipe( + getBaseMetaTileEntity(), + false, + gregtech.api.enums.GT_Values.V[tTier], + tFluidInputs, + mInventory[1]); - if (tRecipe == null) - return false; + if (tRecipe == null) return false; if (tRecipe.isRecipeInputEqual(true, tFluidInputs, mInventory[1])) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; + // In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; // heatLevel.getTier() starts at 0 if (this.heatLevel.getTier() < 5) { this.mEUt *= 1 - (0.1D * (this.heatLevel.getTier() + 1)); - } - else { + } else { this.mEUt *= 0.5; } - if (this.mEUt > 0) - this.mEUt = (-this.mEUt); + if (this.mEUt > 0) this.mEUt = (-this.mEUt); - this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + this.mOutputFluids = new FluidStack[] {tRecipe.getFluidOutput(0)}; return true; } return false; @@ -208,8 +253,7 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - if (mInputOnSide == 1) - return false; + if (mInputOnSide == 1) return false; mInputOnSide = 0; mOutputOnSide = 1; GT_MetaTileEntity_Hatch_Input tHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity; @@ -218,8 +262,7 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult return mInputHatches.add(tHatch); } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - if (mOutputOnSide == 1) - return false; + if (mOutputOnSide == 1) return false; mInputOnSide = 1; mOutputOnSide = 0; GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity; @@ -234,8 +277,7 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - if (mInputOnSide == 0) - return false; + if (mInputOnSide == 0) return false; mInputOnSide = 1; mOutputOnSide = 0; GT_MetaTileEntity_Hatch_Input tHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity; @@ -244,8 +286,7 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult return mInputHatches.add(tHatch); } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - if (mOutputOnSide == 0) - return false; + if (mOutputOnSide == 0) return false; mInputOnSide = 0; mOutputOnSide = 1; GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity; @@ -267,9 +308,12 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult mInputOnSide = -1; mOutputOnSide = -1; replaceDeprecatedCoils(aBaseMetaTileEntity); - return checkPiece(STRUCTURE_PIECE_MAIN, 2, 1, 0) && - mInputOnSide != -1 && mOutputOnSide != -1 && mCasingAmount >= 18 && - mMaintenanceHatches.size() == 1 && !mMiddleInputHatches.isEmpty(); + return checkPiece(STRUCTURE_PIECE_MAIN, 2, 1, 0) + && mInputOnSide != -1 + && mOutputOnSide != -1 + && mCasingAmount >= 18 + && mMaintenanceHatches.size() == 1 + && !mMiddleInputHatches.isEmpty(); } @Override @@ -306,24 +350,15 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult for (int xPos = tX - 1; xPos <= tX + 1; xPos += (xDir != 0 ? 1 : 2)) for (int yPos = tY - 1; yPos <= tY + 1; yPos++) for (int zPos = tZ - 1; zPos <= tZ + 1; zPos += (xDir != 0 ? 2 : 1)) { - if ((yPos == tY) && (xPos == tX || zPos == tZ)) - continue; + if ((yPos == tY) && (xPos == tX || zPos == tZ)) continue; byte tUsedMeta = aBaseMetaTileEntity.getMetaID(xPos, yPos, zPos); - if (tUsedMeta < 12) - continue; - if (tUsedMeta > 14) - continue; - if (aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) != GregTech_API.sBlockCasings1) - continue; - - aBaseMetaTileEntity.getWorld().setBlock( - xPos, - yPos, - zPos, - GregTech_API.sBlockCasings5, - tUsedMeta - 12, - 3 - ); + if (tUsedMeta < 12) continue; + if (tUsedMeta > 14) continue; + if (aBaseMetaTileEntity.getBlock(xPos, yPos, zPos) != GregTech_API.sBlockCasings1) continue; + + aBaseMetaTileEntity + .getWorld() + .setBlock(xPos, yPos, zPos, GregTech_API.sBlockCasings5, tUsedMeta - 12, 3); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java index 9af495bcb3..a282cb3620 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java @@ -1,5 +1,14 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.GT_Values.*; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.getCasingTextureForId; +import static gregtech.common.GT_UndergroundOil.undergroundOil; +import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; + import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -8,6 +17,9 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -20,19 +32,6 @@ import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static gregtech.api.enums.GT_Values.*; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.getCasingTextureForId; -import static gregtech.common.GT_UndergroundOil.undergroundOil; -import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; - public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_DrillerBase { private final ArrayList<Chunk> mOilFieldChunks = new ArrayList<>(); private int mOilId = 0; @@ -49,18 +48,41 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { - if (aActive) return new ITexture[]{ - getCasingTextureForId(casingTextureIndex), - TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + if (aActive) + return new ITexture[] { getCasingTextureForId(casingTextureIndex), - TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_DRILL_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_DRILL_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + getCasingTextureForId(casingTextureIndex), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_DRILL) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_DRILL_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{getCasingTextureForId(casingTextureIndex)}; + return new ITexture[] {getCasingTextureForId(casingTextureIndex)}; } @Override @@ -74,8 +96,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); mOilId = aNBT.getInteger("mOilId"); - if (aNBT.hasKey("chunkRangeConfig")) - chunkRangeConfig = aNBT.getInteger("chunkRangeConfig"); + if (aNBT.hasKey("chunkRangeConfig")) chunkRangeConfig = aNBT.getInteger("chunkRangeConfig"); } protected GT_Multiblock_Tooltip_Builder createTooltip(String tierSuffix) { @@ -83,11 +104,14 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Pump") - .addInfo("Controller Block for the Oil/Gas/Fluid Drilling Rig " + (tierSuffix != null ? tierSuffix : "")) + .addInfo( + "Controller Block for the Oil/Gas/Fluid Drilling Rig " + (tierSuffix != null ? tierSuffix : "")) .addInfo("Works on " + getRangeInChunks() + "x" + getRangeInChunks() + " chunks") .addInfo("Use a Screwdriver to configure range") .addInfo("Use Programmed Circuits to ignore near exhausted oil field") - .addInfo("If total circuit # is greater than output amount it will halt. If it worked right.")//doesn't work + .addInfo( + "If total circuit # is greater than output amount it will halt. If it worked right.") // doesn't + // work .addSeparator() .beginStructureBlock(3, 7, 3, false) .addController("Front bottom") @@ -102,10 +126,10 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D return tt; } - @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png"); } protected abstract int getRangeInChunks(); @@ -118,17 +142,19 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D if (chunkRangeConfig > 0) { chunkRangeConfig--; } - if (chunkRangeConfig == 0) - chunkRangeConfig = getRangeInChunks(); + if (chunkRangeConfig == 0) chunkRangeConfig = getRangeInChunks(); } else { if (chunkRangeConfig <= getRangeInChunks()) { chunkRangeConfig++; } - if (chunkRangeConfig > getRangeInChunks()) - chunkRangeConfig = 1; + if (chunkRangeConfig > getRangeInChunks()) chunkRangeConfig = 1; } if (oldChunkRange != chunkRangeConfig) mOilFieldChunks.clear(); - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + chunkRangeConfig + "x" + chunkRangeConfig + StatCollector.translateToLocal("GT5U.machines.chunks"));//TODO Add translation support + GT_Utility.sendChatToPlayer( + aPlayer, + StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + chunkRangeConfig + "x" + + chunkRangeConfig + + StatCollector.translateToLocal("GT5U.machines.chunks")); // TODO Add translation support } @Override @@ -141,23 +167,30 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D this.mEfficiency = getCurrentEfficiency(null); this.mEfficiencyIncrease = 10000; int tier = Math.max(0, GT_Utility.getTier(getMaxInputVoltage())); - this.mEUt = -7 << (tier << 1);//(1/4) A of current tier when at bottom (7/8) A of current tier while mining - this.mMaxProgresstime = Math.max(1, - (workState == STATE_AT_BOTTOM ? - (64 * (chunkRangeConfig * chunkRangeConfig))>>(getMinTier()-1) : - 120 - ) >> tier); + this.mEUt = -7 << (tier << 1); // (1/4) A of current tier when at bottom (7/8) A of current tier while mining + this.mMaxProgresstime = Math.max( + 1, + (workState == STATE_AT_BOTTOM + ? (64 * (chunkRangeConfig * chunkRangeConfig)) >> (getMinTier() - 1) + : 120) + >> tier); } - protected float computeSpeed(){ - return .5F+(GT_Utility.getTier(getMaxInputVoltage()) - getMinTier()) *.25F; + protected float computeSpeed() { + return .5F + (GT_Utility.getTier(getMaxInputVoltage()) - getMinTier()) * .25F; } @Override - protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { + protected boolean workingAtBottom( + ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { switch (tryLowerPipeState(true)) { - case 0: workState = STATE_DOWNWARD; setElectricityStats(); return true; - case 3: workState = STATE_UPWARD; return true; + case 0: + workState = STATE_DOWNWARD; + setElectricityStats(); + return true; + case 3: + workState = STATE_UPWARD; + return true; } if (reachingVoidOrBedrock() && tryFillChunkList()) { @@ -168,17 +201,17 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D } float speed = computeSpeed(); FluidStack tFluid = pumpOil(speed); - if (tFluid != null && tFluid.amount > getTotalConfigValue()){ - this.mOutputFluids = new FluidStack[]{tFluid}; + if (tFluid != null && tFluid.amount > getTotalConfigValue()) { + this.mOutputFluids = new FluidStack[] {tFluid}; return true; } } - GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity()); + GT_ChunkManager.releaseTicket((TileEntity) getBaseMetaTileEntity()); workState = STATE_UPWARD; return true; } - private boolean tryFillChunkList(){ + private boolean tryFillChunkList() { FluidStack tFluid, tOil; if (mOilId <= 0) { tFluid = undergroundOilReadInformation(getBaseMetaTileEntity()); @@ -186,95 +219,80 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D mOilId = tFluid.getFluidID(); } if (debugDriller) { - GT_Log.out.println( - " Driller on fluid = " + mOilId - ); + GT_Log.out.println(" Driller on fluid = " + mOilId); } tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0); if (mOilFieldChunks.isEmpty()) { - Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); + Chunk tChunk = getBaseMetaTileEntity() + .getWorld() + .getChunkFromBlockCoords( + getBaseMetaTileEntity().getXCoord(), + getBaseMetaTileEntity().getZCoord()); int range = chunkRangeConfig; - int xChunk = Math.floorDiv(tChunk.xPosition,range) * range; //Java was written by idiots. For negative values, / returns rounded towards zero. Fucking morons. - int zChunk = Math.floorDiv(tChunk.zPosition,range) * range; + int xChunk = Math.floorDiv(tChunk.xPosition, range) + * range; // Java was written by idiots. For negative values, / returns rounded towards zero. + // Fucking morons. + int zChunk = Math.floorDiv(tChunk.zPosition, range) * range; if (debugDriller) { - GT_Log.out.println( - "tChunk.xPosition = " + tChunk.xPosition + - " tChunk.zPosition = " + tChunk.zPosition + - " xChunk = " + xChunk + - " zChunk = " + zChunk - ); + GT_Log.out.println("tChunk.xPosition = " + tChunk.xPosition + " tChunk.zPosition = " + + tChunk.zPosition + " xChunk = " + + xChunk + " zChunk = " + + zChunk); } for (int i = 0; i < range; i++) { for (int j = 0; j < range; j++) { if (debugDriller) { - GT_Log.out.println( - " getChunkX = " + (xChunk + i) + - " getChunkZ = " + (zChunk + j) - ); + GT_Log.out.println(" getChunkX = " + (xChunk + i) + " getChunkZ = " + (zChunk + j)); } tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i, zChunk + j); tFluid = undergroundOilReadInformation(tChunk); if (debugDriller) { GT_Log.out.println( - " Fluid in chunk = " + tFluid.getFluid().getID() - ); + " Fluid in chunk = " + tFluid.getFluid().getID()); } if (tOil.isFluidEqual(tFluid) && tFluid.amount > 0) { mOilFieldChunks.add(tChunk); if (debugDriller) { - GT_Log.out.println( - " Matching fluid, quantity = " + tFluid.amount - ); + GT_Log.out.println(" Matching fluid, quantity = " + tFluid.amount); } } } } } if (debugDriller) { - GT_Log.out.println( - "mOilFieldChunks.size = " + mOilFieldChunks.size() - ); + GT_Log.out.println("mOilFieldChunks.size = " + mOilFieldChunks.size()); } return !mOilFieldChunks.isEmpty(); } - protected FluidStack pumpOil(float speed){ + protected FluidStack pumpOil(float speed) { if (mOilId <= 0) return null; FluidStack tFluid, tOil; tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0); if (debugDriller) { - GT_Log.out.println( - " pump speed = " + speed - ); + GT_Log.out.println(" pump speed = " + speed); } ArrayList<Chunk> emptyChunks = new ArrayList<>(); for (Chunk tChunk : mOilFieldChunks) { - tFluid = undergroundOil(tChunk,speed); + tFluid = undergroundOil(tChunk, speed); if (debugDriller) { - GT_Log.out.println( - " chunkX = " + tChunk.getChunkCoordIntPair().chunkXPos + - " chunkZ = " + tChunk.getChunkCoordIntPair().chunkZPos - ); - if( tFluid != null ) { - GT_Log.out.println( - " Fluid pumped = " + tFluid.amount - ); + GT_Log.out.println(" chunkX = " + tChunk.getChunkCoordIntPair().chunkXPos + " chunkZ = " + + tChunk.getChunkCoordIntPair().chunkZPos); + if (tFluid != null) { + GT_Log.out.println(" Fluid pumped = " + tFluid.amount); } else { - GT_Log.out.println( - " No fluid pumped " - ); + GT_Log.out.println(" No fluid pumped "); } - } - if (tFluid == null || tFluid.amount<1) emptyChunks.add(tChunk); + if (tFluid == null || tFluid.amount < 1) emptyChunks.add(tChunk); if (tOil.isFluidEqual(tFluid)) tOil.amount += tFluid.amount; } - for( Chunk tChunk : emptyChunks) { - mOilFieldChunks.remove( tChunk ); + for (Chunk tChunk : emptyChunks) { + mOilFieldChunks.remove(tChunk); } mOilFlow = tOil.amount; return tOil.amount == 0 ? null : tOil; @@ -282,11 +300,18 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D @Override public String[] getInfoData() { - List<String> l = new ArrayList<>(Arrays.asList(EnumChatFormatting.BLUE + StatCollector.translateToLocal("GT5U.machines.oilfluidpump") + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.machines.workarea") + ": " + EnumChatFormatting.GREEN + (chunkRangeConfig) + " x " + (chunkRangeConfig) + - EnumChatFormatting.RESET + " " + StatCollector.translateToLocal("GT5U.machines.chunks"), - "Drilling fluid: " + EnumChatFormatting.GREEN + (mOilId > 0 ? FluidRegistry.getFluid(mOilId).getName() : "None") + EnumChatFormatting.RESET, - "Drilling flow: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mMaxProgresstime > 0 ? (mOilFlow / this.mMaxProgresstime) : 0) + EnumChatFormatting.RESET + " L/t")); + List<String> l = new ArrayList<>(Arrays.asList( + EnumChatFormatting.BLUE + + StatCollector.translateToLocal("GT5U.machines.oilfluidpump") + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.machines.workarea") + ": " + EnumChatFormatting.GREEN + + (chunkRangeConfig) + " x " + (chunkRangeConfig) + EnumChatFormatting.RESET + " " + + StatCollector.translateToLocal("GT5U.machines.chunks"), + "Drilling fluid: " + EnumChatFormatting.GREEN + + (mOilId > 0 ? FluidRegistry.getFluid(mOilId).getName() : "None") + EnumChatFormatting.RESET, + "Drilling flow: " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(this.mMaxProgresstime > 0 ? (mOilFlow / this.mMaxProgresstime) : 0) + + EnumChatFormatting.RESET + " L/t")); l.addAll(Arrays.asList(super.getInfoData())); return l.toArray(new String[0]); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillInfinite.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillInfinite.java index 5eb5333045..6fa7c00f0f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillInfinite.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillInfinite.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.GT_Values.VN; + import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -8,9 +10,7 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; import net.minecraftforge.fluids.FluidStack; -import static gregtech.api.enums.GT_Values.VN; - -public class GT_MetaTileEntity_OilDrillInfinite extends GT_MetaTileEntity_OilDrillBase{ +public class GT_MetaTileEntity_OilDrillInfinite extends GT_MetaTileEntity_OilDrillBase { public GT_MetaTileEntity_OilDrillInfinite(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -47,7 +47,7 @@ public class GT_MetaTileEntity_OilDrillInfinite extends GT_MetaTileEntity_OilDri } @Override - protected FluidStack pumpOil(float speed){ + protected FluidStack pumpOil(float speed) { return super.pumpOil(-speed); } @@ -72,8 +72,8 @@ public class GT_MetaTileEntity_OilDrillInfinite extends GT_MetaTileEntity_OilDri } @Override - protected float computeSpeed(){ - return .5F+(GT_Utility.getTier(getMaxInputVoltage()) - getMinTier()+5) *.25F; + protected float computeSpeed() { + return .5F + (GT_Utility.getTier(getMaxInputVoltage()) - getMinTier() + 5) * .25F; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java index ac3e40c5f5..859f826320 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java @@ -9,12 +9,12 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; public class GT_MetaTileEntity_OreDrillingPlant1 extends GT_MetaTileEntity_OreDrillingPlantBase { public GT_MetaTileEntity_OreDrillingPlant1(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - mTier=1; + mTier = 1; } public GT_MetaTileEntity_OreDrillingPlant1(String aName) { super(aName); - mTier=1; + mTier = 1; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java index bf9c628911..e178bdab83 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java @@ -9,12 +9,12 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; public class GT_MetaTileEntity_OreDrillingPlant2 extends GT_MetaTileEntity_OreDrillingPlantBase { public GT_MetaTileEntity_OreDrillingPlant2(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - mTier=2; + mTier = 2; } public GT_MetaTileEntity_OreDrillingPlant2(String aName) { super(aName); - mTier=2; + mTier = 2; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java index 411bbef3a7..b8ac96a8a7 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java @@ -9,12 +9,12 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; public class GT_MetaTileEntity_OreDrillingPlant3 extends GT_MetaTileEntity_OreDrillingPlantBase { public GT_MetaTileEntity_OreDrillingPlant3(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - mTier=3; + mTier = 3; } public GT_MetaTileEntity_OreDrillingPlant3(String aName) { super(aName); - mTier=3; + mTier = 3; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java index d7daea327c..e4a3da16ac 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java @@ -9,12 +9,12 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; public class GT_MetaTileEntity_OreDrillingPlant4 extends GT_MetaTileEntity_OreDrillingPlantBase { public GT_MetaTileEntity_OreDrillingPlant4(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - mTier=4; + mTier = 4; } public GT_MetaTileEntity_OreDrillingPlant4(String aName) { super(aName); - mTier=4; + mTier = 4; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index 188525c7c9..5116d453fc 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.GT_Values.VN; + import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -13,7 +15,10 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; - +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -26,13 +31,6 @@ import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkPosition; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; - -import static gregtech.api.enums.GT_Values.VN; - public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase { private final ArrayList<ChunkPosition> oreBlockPositions = new ArrayList<>(); protected int mTier = 1; @@ -67,7 +65,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OreDrillingPlant.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OreDrillingPlant.png"); } @Override @@ -77,29 +76,31 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile if (chunkRadiusConfig > 0) { chunkRadiusConfig--; } - if (chunkRadiusConfig == 0) - chunkRadiusConfig = getRadiusInChunks(); + if (chunkRadiusConfig == 0) chunkRadiusConfig = getRadiusInChunks(); } else { if (chunkRadiusConfig <= getRadiusInChunks()) { chunkRadiusConfig++; } - if (chunkRadiusConfig > getRadiusInChunks()) - chunkRadiusConfig = 1; + if (chunkRadiusConfig > getRadiusInChunks()) chunkRadiusConfig = 1; } - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (chunkRadiusConfig << 4) + " " + StatCollector.translateToLocal("GT5U.machines.radius")); + GT_Utility.sendChatToPlayer( + aPlayer, + StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (chunkRadiusConfig << 4) + " " + + StatCollector.translateToLocal("GT5U.machines.radius")); } @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) { replaceWithCobblestone = !replaceWithCobblestone; GT_Utility.sendChatToPlayer(aPlayer, "Replace with cobblestone " + replaceWithCobblestone); return true; } @Override - protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { - if (yHead != oldYHead) - oreBlockPositions.clear(); + protected boolean workingDownward( + ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { + if (yHead != oldYHead) oreBlockPositions.clear(); if (mWorkChunkNeedsReload && mChunkLoadingEnabled) { // ask to load machine itself GT_ChunkManager.requestChunkLoad((TileEntity) getBaseMetaTileEntity(), null); @@ -108,16 +109,23 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile fillMineListIfEmpty(xDrill, yDrill, zDrill, xPipe, zPipe, yHead); if (oreBlockPositions.isEmpty()) { switch (tryLowerPipeState()) { - case 2: mMaxProgresstime = 0; return false; - case 3: workState = STATE_UPWARD; return true; - case 1: workState = STATE_AT_BOTTOM; return true; + case 2: + mMaxProgresstime = 0; + return false; + case 3: + workState = STATE_UPWARD; + return true; + case 1: + workState = STATE_AT_BOTTOM; + return true; } - //new layer - fill again + // new layer - fill again fillMineListIfEmpty(xDrill, yDrill, zDrill, xPipe, zPipe, yHead); } return processOreList(); } - private boolean processOreList(){ + + private boolean processOreList() { ChunkPosition oreBlockPos = null; int x = 0, y = 0, z = 0; Block oreBlock = null; @@ -147,16 +155,22 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile Collection<ItemStack> oreBlockDrops = getBlockDrops(oreBlock, x, y, z); ItemStack cobble = GT_Utility.getCobbleForOre(oreBlock, metaData); if (replaceWithCobblestone) { - getBaseMetaTileEntity().getWorld().setBlock(x, y, z, Block.getBlockFromItem(cobble.getItem()), cobble.getItemDamage(), 3); + getBaseMetaTileEntity() + .getWorld() + .setBlock(x, y, z, Block.getBlockFromItem(cobble.getItem()), cobble.getItemDamage(), 3); } else { - getBaseMetaTileEntity().getWorld().setBlockToAir(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + getBaseMetaTileEntity() + .getWorld() + .setBlockToAir(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); } mOutputItems = getOutputByDrops(oreBlockDrops); } return true; } + @Override - protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { + protected boolean workingAtBottom( + ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { if (!mChunkLoadingEnabled) return super.workingAtBottom(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead); @@ -166,16 +180,15 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile } if (mWorkChunkNeedsReload) { - GT_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), mCurrentChunk); + GT_ChunkManager.requestChunkLoad((TileEntity) getBaseMetaTileEntity(), mCurrentChunk); mWorkChunkNeedsReload = false; return true; } - if (oreBlockPositions.isEmpty()){ + if (oreBlockPositions.isEmpty()) { fillChunkMineList(yHead, yDrill); if (oreBlockPositions.isEmpty()) { - GT_ChunkManager.releaseChunk((TileEntity)getBaseMetaTileEntity(), mCurrentChunk); - if (!moveToNextChunk(xDrill >> 4, zDrill >> 4)) - workState = STATE_UPWARD; + GT_ChunkManager.releaseChunk((TileEntity) getBaseMetaTileEntity(), mCurrentChunk); + if (!moveToNextChunk(xDrill >> 4, zDrill >> 4)) workState = STATE_UPWARD; return true; } } @@ -188,24 +201,24 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile // use corner closest to the drill as mining area center final int leftRight = (getXDrill() - (centerX << 4)) < 8 ? 0 : 1; final int topBottom = (getZDrill() - (centerZ << 4)) < 8 ? 0 : 1; - mCurrentChunk = new ChunkCoordIntPair(centerX - chunkRadiusConfig + leftRight, centerZ - chunkRadiusConfig + topBottom); - GT_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), mCurrentChunk); + mCurrentChunk = + new ChunkCoordIntPair(centerX - chunkRadiusConfig + leftRight, centerZ - chunkRadiusConfig + topBottom); + GT_ChunkManager.requestChunkLoad((TileEntity) getBaseMetaTileEntity(), mCurrentChunk); mWorkChunkNeedsReload = false; } @Override - protected boolean workingUpward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { + protected boolean workingUpward( + ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { if (!mChunkLoadingEnabled || oreBlockPositions.isEmpty()) return super.workingUpward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead); boolean result = processOreList(); - if (oreBlockPositions.isEmpty()) - GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity()); + if (oreBlockPositions.isEmpty()) GT_ChunkManager.releaseTicket((TileEntity) getBaseMetaTileEntity()); return result; } - private boolean moveToNextChunk(int centerX, int centerZ){ - if (mCurrentChunk == null) - return false; + private boolean moveToNextChunk(int centerX, int centerZ) { + if (mCurrentChunk == null) return false; // use corner closest to the drill as mining area center final int left = centerX - chunkRadiusConfig + ((getXDrill() - (centerX << 4)) < 8 ? 0 : 1); final int right = left + chunkRadiusConfig * 2; @@ -234,13 +247,17 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile return false; } mCurrentChunk = new ChunkCoordIntPair(nextChunkX, nextChunkZ); - GT_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), new ChunkCoordIntPair(nextChunkX, nextChunkZ)); + GT_ChunkManager.requestChunkLoad( + (TileEntity) getBaseMetaTileEntity(), new ChunkCoordIntPair(nextChunkX, nextChunkZ)); return true; } @Override - protected boolean checkHatches(){ - return !mMaintenanceHatches.isEmpty() && !mInputHatches.isEmpty() && !mOutputBusses.isEmpty() && !mEnergyHatches.isEmpty(); + protected boolean checkHatches() { + return !mMaintenanceHatches.isEmpty() + && !mInputHatches.isEmpty() + && !mOutputBusses.isEmpty() + && !mEnergyHatches.isEmpty(); } @Override @@ -249,7 +266,9 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile this.mEfficiencyIncrease = 10000; int tier = Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); this.mEUt = -3 * (1 << (tier << 1)); - this.mMaxProgresstime = ((workState == STATE_DOWNWARD || workState == STATE_AT_BOTTOM) ? getBaseProgressTime() : 80) / (1 <<tier); + this.mMaxProgresstime = + ((workState == STATE_DOWNWARD || workState == STATE_AT_BOTTOM) ? getBaseProgressTime() : 80) + / (1 << tier); this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); } @@ -261,7 +280,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile outputItems.add(multiplyStackSize(currentItem)); return; } - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, voltage, null, currentItem); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe( + getBaseMetaTileEntity(), false, voltage, null, currentItem); if (tRecipe == null) { outputItems.add(currentItem); return; @@ -280,14 +300,14 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile ItemData itemData = GT_OreDictUnificator.getItemData(currentItem); return itemData == null || itemData.mPrefix != OrePrefixes.crushed - && itemData.mPrefix != OrePrefixes.dustImpure - && itemData.mPrefix != OrePrefixes.dust - && itemData.mPrefix != OrePrefixes.gem - && itemData.mPrefix != OrePrefixes.gemChipped - && itemData.mPrefix != OrePrefixes.gemExquisite - && itemData.mPrefix != OrePrefixes.gemFlawed - && itemData.mPrefix != OrePrefixes.gemFlawless - && itemData.mMaterial.mMaterial != Materials.Oilsands; + && itemData.mPrefix != OrePrefixes.dustImpure + && itemData.mPrefix != OrePrefixes.dust + && itemData.mPrefix != OrePrefixes.gem + && itemData.mPrefix != OrePrefixes.gemChipped + && itemData.mPrefix != OrePrefixes.gemExquisite + && itemData.mPrefix != OrePrefixes.gemFlawed + && itemData.mPrefix != OrePrefixes.gemFlawless + && itemData.mMaterial.mMaterial != Materials.Oilsands; } private ItemStack multiplyStackSize(ItemStack itemStack) { @@ -299,8 +319,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile final int blockMeta = getBaseMetaTileEntity().getMetaID(posX, posY, posZ); if (oreBlock.canSilkHarvest(getBaseMetaTileEntity().getWorld(), null, posX, posY, posZ, blockMeta)) { return Collections.singleton(new ItemStack(oreBlock, 1, blockMeta)); - } else - return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier + 3); + } else return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier + 3); } private boolean tryConsumeDrillingFluid() { @@ -312,32 +331,26 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile } private void fillChunkMineList(int yHead, int yDrill) { - if (mCurrentChunk == null || !oreBlockPositions.isEmpty()) - return; + if (mCurrentChunk == null || !oreBlockPositions.isEmpty()) return; final int minX = mCurrentChunk.chunkXPos << 4; final int maxX = minX + 16; final int minZ = mCurrentChunk.chunkZPos << 4; final int maxZ = minZ + 16; for (int x = minX; x < maxX; ++x) - for (int z = minZ; z < maxZ; ++z) - for (int y = yHead; y < yDrill; ++y) - tryAddOreBlockToMineList(x, y, z); + for (int z = minZ; z < maxZ; ++z) for (int y = yHead; y < yDrill; ++y) tryAddOreBlockToMineList(x, y, z); } private void fillMineListIfEmpty(int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead) { - if (!oreBlockPositions.isEmpty()) - return; + if (!oreBlockPositions.isEmpty()) return; tryAddOreBlockToMineList(xPipe, yHead - 1, zPipe); - if (yHead == yDrill) - return; //skip controller block layer + if (yHead == yDrill) return; // skip controller block layer if (mChunkLoadingEnabled) { int startX = (xDrill >> 4) << 4; int startZ = (zDrill >> 4) << 4; for (int x = startX; x < (startX + 16); ++x) - for (int z = startZ; z < (startZ + 16); ++z) - tryAddOreBlockToMineList(x, yHead, z); + for (int z = startZ; z < (startZ + 16); ++z) tryAddOreBlockToMineList(x, yHead, z); } else { int radius = chunkRadiusConfig << 4; for (int xOff = -radius; xOff <= radius; xOff++) @@ -355,8 +368,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z); if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) oreBlockPositions.add(blockPos); - } else if (GT_Utility.isOre(block, blockMeta)) - oreBlockPositions.add(blockPos); + } else if (GT_Utility.isOre(block, blockMeta)) oreBlockPositions.add(blockPos); } } @@ -368,37 +380,39 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile String casings = getCasingBlockItem().get(0).getDisplayName(); final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Miner") - .addInfo("Controller Block for the Ore Drilling Plant " + (tierSuffix != null ? tierSuffix : "")) - .addInfo("Use a Screwdriver to configure block radius") - .addInfo("Maximum radius is " + (getRadiusInChunks() << 4) + " blocks") - .addInfo("Use Soldering iron to turn off chunk mode") - .addInfo("Use Wire Cutter to toggle replacing mined blocks with cobblestone") - .addInfo("In chunk mode, working area center is the chunk corner nearest to the drill") - .addInfo("Gives ~3x as much crushed ore vs normal processing") - .addInfo("Fortune bonus of " + (mTier + 3) + ". Only works on small ores") - .addSeparator() - .beginStructureBlock(3, 7, 3, false) - .addController("Front bottom") - .addOtherStructurePart(casings, "form the 3x1x3 Base") - .addOtherStructurePart(casings, "1x3x1 pillar above the center of the base (2 minimum total)") - .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top") - .addEnergyHatch(VN[getMinTier()] + "+, Any base casing", 1) - .addMaintenanceHatch("Any base casing", 1) - .addInputBus("Mining Pipes, optional, any base casing", 1) - .addInputHatch("Drilling Fluid, any base casing", 1) - .addOutputBus("Any base casing", 1) - .toolTipFinisher("Gregtech"); - return tt; + tt.addMachineType("Miner") + .addInfo("Controller Block for the Ore Drilling Plant " + (tierSuffix != null ? tierSuffix : "")) + .addInfo("Use a Screwdriver to configure block radius") + .addInfo("Maximum radius is " + (getRadiusInChunks() << 4) + " blocks") + .addInfo("Use Soldering iron to turn off chunk mode") + .addInfo("Use Wire Cutter to toggle replacing mined blocks with cobblestone") + .addInfo("In chunk mode, working area center is the chunk corner nearest to the drill") + .addInfo("Gives ~3x as much crushed ore vs normal processing") + .addInfo("Fortune bonus of " + (mTier + 3) + ". Only works on small ores") + .addSeparator() + .beginStructureBlock(3, 7, 3, false) + .addController("Front bottom") + .addOtherStructurePart(casings, "form the 3x1x3 Base") + .addOtherStructurePart(casings, "1x3x1 pillar above the center of the base (2 minimum total)") + .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top") + .addEnergyHatch(VN[getMinTier()] + "+, Any base casing", 1) + .addMaintenanceHatch("Any base casing", 1) + .addInputBus("Mining Pipes, optional, any base casing", 1) + .addInputHatch("Drilling Fluid, any base casing", 1) + .addOutputBus("Any base casing", 1) + .toolTipFinisher("Gregtech"); + return tt; } @Override public String[] getInfoData() { final int diameter = chunkRadiusConfig * 2; - return new String[]{ - EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.minermulti")+EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + diameter + "x" + diameter + - EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.chunks") + return new String[] { + EnumChatFormatting.BLUE + + StatCollector.translateToLocal("GT5U.machines.minermulti") + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.machines.workarea") + ": " + EnumChatFormatting.GREEN + diameter + "x" + + diameter + EnumChatFormatting.RESET + " " + StatCollector.translateToLocal("GT5U.machines.chunks") }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java index 10b1b3eec8..210d1bfe05 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java @@ -1,6 +1,13 @@ package gregtech.common.tileentities.machines.multi; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.GT_Values.*; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofCoil; +import static java.lang.Math.*; + import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -20,6 +27,8 @@ import gregtech.api.util.GT_ExoticEnergyInputHelper; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -30,20 +39,8 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.ChunkCoordIntPair; import net.minecraftforge.fluids.FluidStack; -import java.util.List; -import java.util.ArrayList; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.GT_Values.*; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofCoil; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; -import static java.lang.Math.*; - - -public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMultiFurnace<GT_MetaTileEntity_PlasmaForge> implements ISurvivalConstructable { +public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMultiFurnace<GT_MetaTileEntity_PlasmaForge> + implements ISurvivalConstructable { // 3600 seconds in an hour, 8 hours, 20 ticks in a second. private static final double max_efficiency_time_in_ticks = 3600d * 8d * 20d; @@ -76,45 +73,868 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul // Custom long EU per tick value given that mEUt is an int. Required to overclock beyond MAX voltage. private long EU_per_tick = 0; - @SuppressWarnings("SpellCheckingInspection") private static final String[][] structure_string = new String[][] { - {" ", " N N N N ", " N N N N ", " N N N N ", " ", " ", " ", " N N N N ", " N N N N ", " NNN NNN N N NNN NNN ", " ", " ", " ", " NNN NNN NNN NNN ", " ", " ", " ", " ", " ", " NNN NNN NNN NNN ", " ", " ", " ", " NNN NNN NNN NNN "}, - {" N N N N ", " bCCCb bCCCb ", " bCCCb bCCCb ", " bCCCb bCCCb ", " N N N N ", " ", " N N N N ", " bCCCb bCCCb ", " bCCCb bCCCb ", "NbbbN NbbNCCCb bCCCNbbN NbbbN", " CCC CCC N N CCC CCC ", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", "NbbbN NbbbN NbbbN NbbbN", " N N N N ", " N N N N ", " ", " N N N N ", " N N N N ", "NbbbN NbbbN NbbbN NbbbN", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", "NbbbN NbbbN N N NbbbN NbbbN",}, - {" N N N N ", " bCCCb bCCCb ", " NNNbbbbbNNsNNbbbbbNNN ", " ss bCCCb bCCCb ss ", " s N N N N s ", " s s ", " N N N N N N ", " N bCCCb bCCCb N ", " N sbbbbbNNsNNbbbbbs N ", "NbbbN NbbNCCCb bCCCNbbN NbbbN", " CbC CbC N N CbC CbC ", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", "NbbbN NbbbN NbbbN NbbbN", " NNN NNN NNN NNN ", " NNN NNN NNN NNN ", " s s s s ", " NNN NNN NNN NNN ", " NNN NNN NNN NNN ", "NbbbN NbbbN NbbbN NbbbN", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", "NbbbN NbbbNNNNNsNsNNNNNbbbN NbbbN",}, - {" N N N N ", " bCCCb bCCCb ", " ss bCCCb bCCCb ss ", " bCCCb bCCCb ", " s NCCCN NCCCN s ", " s NCCCN NCCCN s ", " NCCCN NCCCN ", " bCCCb bCCCb ", " bCCCb bCCCb ", "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", " CCCCCCCCC N N CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", "NbbbNNNbbbN NbbbNNNbbbN", " N N N N ", " N N N N ", " ", " N N N N ", " N N N N ", "NbbbNNNbbbN NbbbNNNbbbN", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", "NbbbNNNbbbN NbN NbbbNNNbbbN",}, - {" ", " N N N N ", " s N N N N s ", " s NCCCN NCCCN s ", " ", " ", " ", " NCCCN NCCCN ", " N N N N ", " NNN NN N N NN NNN ", " C C C C ", " C C C C ", " C C C C ", " NNN NNN NNN NNN ", " ", " ", " ", " ", " ", " NNN NNN NNN NNN ", " C C C C ", " C C C C ", " C C C C ", " NNN NNN NbN NNN NNN ",}, - {" ", " ", " s s ", " s NCCCN NCCCN s ", " ", " ", " ", " NCCCN NCCCN ", " ", " N N N N ", " C C C C ", " C C C C ", " C C C C ", " N N N N ", " ", " ", " ", " ", " ", " N N N N ", " C C C C ", " C C C C ", " C C C C ", " N N NbN N N ",}, - {" ", " N N N N ", " N N N N N N ", " NCCCN NCCCN ", " ", " ", " ", " NCCCN NCCCN ", " N N N N ", " NNN NN N N NN NNN ", " C C C C ", " C C C C ", " C C C C ", " NNN NNN NNN NNN ", " ", " ", " ", " ", " ", " NNN NNN NNN NNN ", " C C C C ", " C C C C ", " C C C C ", " NNN NNN NbN NNN NNN ",}, - {" N N N N ", " bCCCb bCCCb ", " N bCCCb bCCCb N ", " bCCCb bCCCb ", " NCCCN NCCCN ", " NCCCN NCCCN ", " NCCCN NCCCN ", " bCCCb bCCCb ", " bCCCb bCCCb ", "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", " CCCCCCCCC N N CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", "NbbbNNNbbbN NbbbNNNbbbN", " N N N N ", " N N N N ", " ", " N N N N ", " N N N N ", "NbbbNNNbbbN NbbbNNNbbbN", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", "NbbbNNNbbbN NbN NbbbNNNbbbN",}, - {" N N N N ", " bCCCb bCCCb ", " N sbbbbbNNsNNbbbbbs N ", " bCCCb bCCCb ", " N N N N ", " ", " N N N N ", " bCCCb bCCCb ", " s sbbbbbNNsNNbbbbbs s ", "NbbbN NbbNCCCb bCCCNbbN NbbbN", " CbC CbC N N CbC CbC ", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", "NbbbN NbbbN NbbbN NbbbN", " NNN NNN NNN NNN ", " NNN NNN NNN NNN ", " s s s s ", " NNN NNN NNN NNN ", " NNN NNN NNN NNN ", "NbbbN NbbbN NbbbN NbbbN", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", "NbbbN NbbbNNNNNsNsNNNNNbbbN NbbbN",}, - {" NNN NNN N N NNN NNN ", "NbbbN NbbNCCCb bCCCNbbN NbbbN", "NbbbN NbbNCCCb bCCCNbbN NbbbN", "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", " NNN NNN N N NNN NNN ", " N N N N ", " NNN NNN N N NNN NNN ", "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", "NbbbN NbbNCCCb bCCCNbbN NbbbN", "NNNN NNNCCCb bCCCNNN NNNN", " CCC CCC N N CCC CCC ", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", "NbbbN NbbbN NbbbN NbbbN", " N N N N ", " N N N N ", " ", " N N N N ", " N N N N ", "NbbbN NbbbN NbbbN NbbbN", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", "NbbbN NbbbN NbN NbbbN NbbbN",}, - {" ", " CCC CCC N N CCC CCC ", " CbC CbC N N CbC CbC ", " CCCCCCCCC N N CCCCCCCCC ", " C C C C ", " C C C C ", " C C C C ", " CCCCCCCCC N N CCCCCCCCC ", " CbC CbC N N CbC CbC ", " CCC CCC N N CCC CCC ", " ", " ", " ", " NNN NNN NNN NNN ", " ", " ", " ", " ", " ", " NNN NNN NNN NNN ", " ", " ", " ", " NNN NNN NbN NNN NNN ",}, - {" ", " CCC CCC CCC CCC ", " CbC CbC CbC CbC ", " CCCCCCCCC CCCCCCCCC ", " C C C C ", " C C C C ", " C C C C ", " CCCCCCCCC CCCCCCCCC ", " CbC CbC CbC CbC ", " CCC CCC CCC CCC ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " N N NbN N N ",}, - {" ", " CCC CCC CCC CCC ", " CbC CbC CbC CbC ", " CCCCCCCCC CCCCCCCCC ", " C C C C ", " C C C C ", " C C C C ", " CCCCCCCCC CCCCCCCCC ", " CbC CbC CbC CbC ", " CCC CCC CCC CCC ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " N N NbN N N ",}, - {" NNN NNN NNN NNN ", "NbbbN NbbbN NbbbN NbbbN", "NbbbN NbbbN NbbbN NbbbN", "NbbbNNNbbbN NbbbNNNbbbN", " NNN NNN NNN NNN ", " N N N N ", " NNN NNN NNN NNN ", "NbbbNNNbbbN NbbbNNNbbbN", "NbbbN NbbbN NbbbN NbbbN", "NbbbN NbbbN NbbbN NbbbN", " NNN NNN NNN NNN ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " N N NsNsN N N ",}, - {" ", " ", " N N N N ", " ", " ", " ", " ", " ", " N N N N ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " N N NbbbbbN N N ",}, - {" ", " ", " N N N N ", " ", " ", " ", " ", " ", " N N N N ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " N ", " NsNNNNNsNNNNsbbbbbsNNNNsNNNNNsN ",}, - {" ", " ", " s s s s ", " ", " ", " ", " ", " ", " s s s s ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ~ ", " NNN ", " NbbbbbNbbbbNbbbbbNbbbbNbbbbbN ",}, - {" ", " ", " N N N N ", " ", " ", " ", " ", " ", " N N N N ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " N ", " NsNNNNNsNNNNsbbbbbsNNNNsNNNNNsN ",}, - {" ", " ", " N N N N ", " ", " ", " ", " ", " ", " N N N N ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " N N NbbbbbN N N ",}, - {" NNN NNN NNN NNN ", "NbbbN NbbbN NbbbN NbbbN", "NbbbN NbbbN NbbbN NbbbN", "NbbbNNNbbbN NbbbNNNbbbN", " NNN NNN NNN NNN ", " N N N N ", " NNN NNN NNN NNN ", "NbbbNNNbbbN NbbbNNNbbbN", "NbbbN NbbbN NbbbN NbbbN", "NbbbN NbbbN NbbbN NbbbN", " NNN NNN NNN NNN ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " N N NsNsN N N ",}, - {" ", " CCC CCC CCC CCC ", " CbC CbC CbC CbC ", " CCCCCCCCC CCCCCCCCC ", " C C C C ", " C C C C ", " C C C C ", " CCCCCCCCC CCCCCCCCC ", " CbC CbC CbC CbC ", " CCC CCC CCC CCC ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " N N NbN N N ",}, - {" ", " CCC CCC CCC CCC ", " CbC CbC CbC CbC ", " CCCCCCCCC CCCCCCCCC ", " C C C C ", " C C C C ", " C C C C ", " CCCCCCCCC CCCCCCCCC ", " CbC CbC CbC CbC ", " CCC CCC CCC CCC ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " N N NbN N N ",}, - {" ", " CCC CCC N N CCC CCC ", " CbC CbC N N CbC CbC ", " CCCCCCCCC N N CCCCCCCCC ", " C C C C ", " C C C C ", " C C C C ", " CCCCCCCCC N N CCCCCCCCC ", " CbC CbC N N CbC CbC ", " CCC CCC N N CCC CCC ", " ", " ", " ", " NNN NNN NNN NNN ", " ", " ", " ", " ", " ", " NNN NNN NNN NNN ", " ", " ", " ", " NNN NNN NbN NNN NNN ",}, - {" NNN NNN N N NNN NNN ", "NbbbN NbbNCCCb bCCCNbbN NbbbN", "NbbbN NbbNCCCb bCCCNbbN NbbbN", "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", " NNN NNN N N NNN NNN ", " N N N N ", " NNN NNN N N NNN NNN ", "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", "NbbbN NbbNCCCb bCCCNbbN NbbbN", "NNNN NNNCCCb bCCCNNN NNNN", " CCC CCC N N CCC CCC ", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", "NbbbN NbbbN NbbbN NbbbN", " N N N N ", " N N N N ", " ", " N N N N ", " N N N N ", "NbbbN NbbbN NbbbN NbbbN", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", "NbbbN NbbbN NbN NbbbN NbbbN",}, - {" N N N N ", " bCCCb bCCCb ", " N sbbbbbNNsNNbbbbbs N ", " bCCCb bCCCb ", " N N N N ", " ", " N N N N ", " bCCCb bCCCb ", " s sbbbbbNNsNNbbbbbs s ", "NbbbN NbbNCCCb bCCCNbbN NbbbN", " CbC CbC N N CbC CbC ", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", "NbbbN NbbbN NbbbN NbbbN", " NNN NNN NNN NNN ", " NNN NNN NNN NNN ", " s s s s ", " NNN NNN NNN NNN ", " NNN NNN NNN NNN ", "NbbbN NbbbN NbbbN NbbbN", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", "NbbbN NbbbNNNNNsNsNNNNNbbbN NbbbN",}, - {" N N N N ", " bCCCb bCCCb ", " N bCCCb bCCCb N ", " bCCCb bCCCb ", " NCCCN NCCCN ", " NCCCN NCCCN ", " NCCCN NCCCN ", " bCCCb bCCCb ", " bCCCb bCCCb ", "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", " CCCCCCCCC N N CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", "NbbbNNNbbbN NbbbNNNbbbN", " N N N N ", " N N N N ", " ", " N N N N ", " N N N N ", "NbbbNNNbbbN NbbbNNNbbbN", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", "NbbbNNNbbbN NbN NbbbNNNbbbN",}, - {" ", " N N N N ", " N N N N N N ", " NCCCN NCCCN ", " ", " ", " ", " NCCCN NCCCN ", " N N N N ", " NNN NN N N NN NNN ", " C C C C ", " C C C C ", " C C C C ", " NNN NNN NNN NNN ", " ", " ", " ", " ", " ", " NNN NNN NNN NNN ", " C C C C ", " C C C C ", " C C C C ", " NNN NNN NbN NNN NNN ",}, - {" ", " ", " s s ", " s NCCCN NCCCN s ", " ", " ", " ", " NCCCN NCCCN ", " ", " N N N N ", " C C C C ", " C C C C ", " C C C C ", " N N N N ", " ", " ", " ", " ", " ", " N N N N ", " C C C C ", " C C C C ", " C C C C ", " N N NbN N N ",}, - {" ", " N N N N ", " s N N N N s ", " s NCCCN NCCCN s ", " ", " ", " ", " NCCCN NCCCN ", " N N N N ", " NNN NN N N NN NNN ", " C C C C ", " C C C C ", " C C C C ", " NNN NNN NNN NNN ", " ", " ", " ", " ", " ", " NNN NNN NNN NNN ", " C C C C ", " C C C C ", " C C C C ", " NNN NNN NbN NNN NNN ",}, - {" N N N N ", " bCCCb bCCCb ", " ss bCCCb bCCCb ss ", " bCCCb bCCCb ", " s NCCCN NCCCN s ", " s NCCCN NCCCN s ", " NCCCN NCCCN ", " bCCCb bCCCb ", " bCCCb bCCCb ", "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", " CCCCCCCCC N N CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", "NbbbNNNbbbN NbbbNNNbbbN", " N N N N ", " N N N N ", " ", " N N N N ", " N N N N ", "NbbbNNNbbbN NbbbNNNbbbN", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", " CCCCCCCCC CCCCCCCCC ", "NbbbNNNbbbN NbN NbbbNNNbbbN",}, - {" N N N N ", " bCCCb bCCCb ", " NNNbbbbbNNsNNbbbbbNNN ", " ss bCCCb bCCCb ss ", " s N N N N s ", " s s ", " N N N N N N ", " N bCCCb bCCCb N ", " N sbbbbbNNsNNbbbbbs N ", "NbbbN NbbNCCCb bCCCNbbN NbbbN", " CbC CbC N N CbC CbC ", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", "NbbbN NbbbN NbbbN NbbbN", " NNN NNN NNN NNN ", " NNN NNN NNN NNN ", " s s s s ", " NNN NNN NNN NNN ", " NNN NNN NNN NNN ", "NbbbN NbbbN NbbbN NbbbN", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", " CbC CbC CbC CbC ", "NbbbN NbbbNNNNNsNsNNNNNbbbN NbbbN",}, - {" N N N N ", " bCCCb bCCCb ", " bCCCb bCCCb ", " bCCCb bCCCb ", " N N N N ", " ", " N N N N ", " bCCCb bCCCb ", " bCCCb bCCCb ", "NbbbN NbbNCCCb bCCCNbbN NbbbN", " CCC CCC N N CCC CCC ", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", "NbbbN NbbbN NbbbN NbbbN", " N N N N ", " N N N N ", " ", " N N N N ", " N N N N ", "NbbbN NbbbN NbbbN NbbbN", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", " CCC CCC CCC CCC ", "NbbbN NbbbN N N NbbbN NbbbN",}, - {" ", " N N N N ", " N N N N ", " N N N N ", " ", " ", " ", " N N N N ", " N N N N ", " NNN NNN N N NNN NNN ", " ", " ", " ", " NNN NNN NNN NNN ", " ", " ", " ", " ", " ", " NNN NNN NNN NNN ", " ", " ", " ", " NNN NNN NNN NNN ",} + { + " ", + " N N N N ", + " N N N N ", + " N N N N ", + " ", + " ", + " ", + " N N N N ", + " N N N N ", + " NNN NNN N N NNN NNN ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " NNN NNN NNN NNN " + }, + { + " N N N N ", + " bCCCb bCCCb ", + " bCCCb bCCCb ", + " bCCCb bCCCb ", + " N N N N ", + " ", + " N N N N ", + " bCCCb bCCCb ", + " bCCCb bCCCb ", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + " CCC CCC N N CCC CCC ", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + "NbbbN NbbbN NbbbN NbbbN", + " N N N N ", + " N N N N ", + " ", + " N N N N ", + " N N N N ", + "NbbbN NbbbN NbbbN NbbbN", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + "NbbbN NbbbN N N NbbbN NbbbN", + }, + { + " N N N N ", + " bCCCb bCCCb ", + " NNNbbbbbNNsNNbbbbbNNN ", + " ss bCCCb bCCCb ss ", + " s N N N N s ", + " s s ", + " N N N N N N ", + " N bCCCb bCCCb N ", + " N sbbbbbNNsNNbbbbbs N ", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + " CbC CbC N N CbC CbC ", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + "NbbbN NbbbN NbbbN NbbbN", + " NNN NNN NNN NNN ", + " NNN NNN NNN NNN ", + " s s s s ", + " NNN NNN NNN NNN ", + " NNN NNN NNN NNN ", + "NbbbN NbbbN NbbbN NbbbN", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + "NbbbN NbbbNNNNNsNsNNNNNbbbN NbbbN", + }, + { + " N N N N ", + " bCCCb bCCCb ", + " ss bCCCb bCCCb ss ", + " bCCCb bCCCb ", + " s NCCCN NCCCN s ", + " s NCCCN NCCCN s ", + " NCCCN NCCCN ", + " bCCCb bCCCb ", + " bCCCb bCCCb ", + "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", + " CCCCCCCCC N N CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + "NbbbNNNbbbN NbbbNNNbbbN", + " N N N N ", + " N N N N ", + " ", + " N N N N ", + " N N N N ", + "NbbbNNNbbbN NbbbNNNbbbN", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + "NbbbNNNbbbN NbN NbbbNNNbbbN", + }, + { + " ", + " N N N N ", + " s N N N N s ", + " s NCCCN NCCCN s ", + " ", + " ", + " ", + " NCCCN NCCCN ", + " N N N N ", + " NNN NN N N NN NNN ", + " C C C C ", + " C C C C ", + " C C C C ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " C C C C ", + " C C C C ", + " C C C C ", + " NNN NNN NbN NNN NNN ", + }, + { + " ", + " ", + " s s ", + " s NCCCN NCCCN s ", + " ", + " ", + " ", + " NCCCN NCCCN ", + " ", + " N N N N ", + " C C C C ", + " C C C C ", + " C C C C ", + " N N N N ", + " ", + " ", + " ", + " ", + " ", + " N N N N ", + " C C C C ", + " C C C C ", + " C C C C ", + " N N NbN N N ", + }, + { + " ", + " N N N N ", + " N N N N N N ", + " NCCCN NCCCN ", + " ", + " ", + " ", + " NCCCN NCCCN ", + " N N N N ", + " NNN NN N N NN NNN ", + " C C C C ", + " C C C C ", + " C C C C ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " C C C C ", + " C C C C ", + " C C C C ", + " NNN NNN NbN NNN NNN ", + }, + { + " N N N N ", + " bCCCb bCCCb ", + " N bCCCb bCCCb N ", + " bCCCb bCCCb ", + " NCCCN NCCCN ", + " NCCCN NCCCN ", + " NCCCN NCCCN ", + " bCCCb bCCCb ", + " bCCCb bCCCb ", + "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", + " CCCCCCCCC N N CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + "NbbbNNNbbbN NbbbNNNbbbN", + " N N N N ", + " N N N N ", + " ", + " N N N N ", + " N N N N ", + "NbbbNNNbbbN NbbbNNNbbbN", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + "NbbbNNNbbbN NbN NbbbNNNbbbN", + }, + { + " N N N N ", + " bCCCb bCCCb ", + " N sbbbbbNNsNNbbbbbs N ", + " bCCCb bCCCb ", + " N N N N ", + " ", + " N N N N ", + " bCCCb bCCCb ", + " s sbbbbbNNsNNbbbbbs s ", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + " CbC CbC N N CbC CbC ", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + "NbbbN NbbbN NbbbN NbbbN", + " NNN NNN NNN NNN ", + " NNN NNN NNN NNN ", + " s s s s ", + " NNN NNN NNN NNN ", + " NNN NNN NNN NNN ", + "NbbbN NbbbN NbbbN NbbbN", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + "NbbbN NbbbNNNNNsNsNNNNNbbbN NbbbN", + }, + { + " NNN NNN N N NNN NNN ", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", + " NNN NNN N N NNN NNN ", + " N N N N ", + " NNN NNN N N NNN NNN ", + "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + "NNNN NNNCCCb bCCCNNN NNNN", + " CCC CCC N N CCC CCC ", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + "NbbbN NbbbN NbbbN NbbbN", + " N N N N ", + " N N N N ", + " ", + " N N N N ", + " N N N N ", + "NbbbN NbbbN NbbbN NbbbN", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + "NbbbN NbbbN NbN NbbbN NbbbN", + }, + { + " ", + " CCC CCC N N CCC CCC ", + " CbC CbC N N CbC CbC ", + " CCCCCCCCC N N CCCCCCCCC ", + " C C C C ", + " C C C C ", + " C C C C ", + " CCCCCCCCC N N CCCCCCCCC ", + " CbC CbC N N CbC CbC ", + " CCC CCC N N CCC CCC ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " NNN NNN NbN NNN NNN ", + }, + { + " ", + " CCC CCC CCC CCC ", + " CbC CbC CbC CbC ", + " CCCCCCCCC CCCCCCCCC ", + " C C C C ", + " C C C C ", + " C C C C ", + " CCCCCCCCC CCCCCCCCC ", + " CbC CbC CbC CbC ", + " CCC CCC CCC CCC ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " N N NbN N N ", + }, + { + " ", + " CCC CCC CCC CCC ", + " CbC CbC CbC CbC ", + " CCCCCCCCC CCCCCCCCC ", + " C C C C ", + " C C C C ", + " C C C C ", + " CCCCCCCCC CCCCCCCCC ", + " CbC CbC CbC CbC ", + " CCC CCC CCC CCC ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " N N NbN N N ", + }, + { + " NNN NNN NNN NNN ", + "NbbbN NbbbN NbbbN NbbbN", + "NbbbN NbbbN NbbbN NbbbN", + "NbbbNNNbbbN NbbbNNNbbbN", + " NNN NNN NNN NNN ", + " N N N N ", + " NNN NNN NNN NNN ", + "NbbbNNNbbbN NbbbNNNbbbN", + "NbbbN NbbbN NbbbN NbbbN", + "NbbbN NbbbN NbbbN NbbbN", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " N N NsNsN N N ", + }, + { + " ", + " ", + " N N N N ", + " ", + " ", + " ", + " ", + " ", + " N N N N ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " N N NbbbbbN N N ", + }, + { + " ", + " ", + " N N N N ", + " ", + " ", + " ", + " ", + " ", + " N N N N ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " N ", + " NsNNNNNsNNNNsbbbbbsNNNNsNNNNNsN ", + }, + { + " ", + " ", + " s s s s ", + " ", + " ", + " ", + " ", + " ", + " s s s s ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ~ ", + " NNN ", + " NbbbbbNbbbbNbbbbbNbbbbNbbbbbN ", + }, + { + " ", + " ", + " N N N N ", + " ", + " ", + " ", + " ", + " ", + " N N N N ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " N ", + " NsNNNNNsNNNNsbbbbbsNNNNsNNNNNsN ", + }, + { + " ", + " ", + " N N N N ", + " ", + " ", + " ", + " ", + " ", + " N N N N ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " N N NbbbbbN N N ", + }, + { + " NNN NNN NNN NNN ", + "NbbbN NbbbN NbbbN NbbbN", + "NbbbN NbbbN NbbbN NbbbN", + "NbbbNNNbbbN NbbbNNNbbbN", + " NNN NNN NNN NNN ", + " N N N N ", + " NNN NNN NNN NNN ", + "NbbbNNNbbbN NbbbNNNbbbN", + "NbbbN NbbbN NbbbN NbbbN", + "NbbbN NbbbN NbbbN NbbbN", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " N N NsNsN N N ", + }, + { + " ", + " CCC CCC CCC CCC ", + " CbC CbC CbC CbC ", + " CCCCCCCCC CCCCCCCCC ", + " C C C C ", + " C C C C ", + " C C C C ", + " CCCCCCCCC CCCCCCCCC ", + " CbC CbC CbC CbC ", + " CCC CCC CCC CCC ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " N N NbN N N ", + }, + { + " ", + " CCC CCC CCC CCC ", + " CbC CbC CbC CbC ", + " CCCCCCCCC CCCCCCCCC ", + " C C C C ", + " C C C C ", + " C C C C ", + " CCCCCCCCC CCCCCCCCC ", + " CbC CbC CbC CbC ", + " CCC CCC CCC CCC ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " N N NbN N N ", + }, + { + " ", + " CCC CCC N N CCC CCC ", + " CbC CbC N N CbC CbC ", + " CCCCCCCCC N N CCCCCCCCC ", + " C C C C ", + " C C C C ", + " C C C C ", + " CCCCCCCCC N N CCCCCCCCC ", + " CbC CbC N N CbC CbC ", + " CCC CCC N N CCC CCC ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " NNN NNN NbN NNN NNN ", + }, + { + " NNN NNN N N NNN NNN ", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", + " NNN NNN N N NNN NNN ", + " N N N N ", + " NNN NNN N N NNN NNN ", + "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + "NNNN NNNCCCb bCCCNNN NNNN", + " CCC CCC N N CCC CCC ", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + "NbbbN NbbbN NbbbN NbbbN", + " N N N N ", + " N N N N ", + " ", + " N N N N ", + " N N N N ", + "NbbbN NbbbN NbbbN NbbbN", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + "NbbbN NbbbN NbN NbbbN NbbbN", + }, + { + " N N N N ", + " bCCCb bCCCb ", + " N sbbbbbNNsNNbbbbbs N ", + " bCCCb bCCCb ", + " N N N N ", + " ", + " N N N N ", + " bCCCb bCCCb ", + " s sbbbbbNNsNNbbbbbs s ", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + " CbC CbC N N CbC CbC ", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + "NbbbN NbbbN NbbbN NbbbN", + " NNN NNN NNN NNN ", + " NNN NNN NNN NNN ", + " s s s s ", + " NNN NNN NNN NNN ", + " NNN NNN NNN NNN ", + "NbbbN NbbbN NbbbN NbbbN", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + "NbbbN NbbbNNNNNsNsNNNNNbbbN NbbbN", + }, + { + " N N N N ", + " bCCCb bCCCb ", + " N bCCCb bCCCb N ", + " bCCCb bCCCb ", + " NCCCN NCCCN ", + " NCCCN NCCCN ", + " NCCCN NCCCN ", + " bCCCb bCCCb ", + " bCCCb bCCCb ", + "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", + " CCCCCCCCC N N CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + "NbbbNNNbbbN NbbbNNNbbbN", + " N N N N ", + " N N N N ", + " ", + " N N N N ", + " N N N N ", + "NbbbNNNbbbN NbbbNNNbbbN", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + "NbbbNNNbbbN NbN NbbbNNNbbbN", + }, + { + " ", + " N N N N ", + " N N N N N N ", + " NCCCN NCCCN ", + " ", + " ", + " ", + " NCCCN NCCCN ", + " N N N N ", + " NNN NN N N NN NNN ", + " C C C C ", + " C C C C ", + " C C C C ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " C C C C ", + " C C C C ", + " C C C C ", + " NNN NNN NbN NNN NNN ", + }, + { + " ", + " ", + " s s ", + " s NCCCN NCCCN s ", + " ", + " ", + " ", + " NCCCN NCCCN ", + " ", + " N N N N ", + " C C C C ", + " C C C C ", + " C C C C ", + " N N N N ", + " ", + " ", + " ", + " ", + " ", + " N N N N ", + " C C C C ", + " C C C C ", + " C C C C ", + " N N NbN N N ", + }, + { + " ", + " N N N N ", + " s N N N N s ", + " s NCCCN NCCCN s ", + " ", + " ", + " ", + " NCCCN NCCCN ", + " N N N N ", + " NNN NN N N NN NNN ", + " C C C C ", + " C C C C ", + " C C C C ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " C C C C ", + " C C C C ", + " C C C C ", + " NNN NNN NbN NNN NNN ", + }, + { + " N N N N ", + " bCCCb bCCCb ", + " ss bCCCb bCCCb ss ", + " bCCCb bCCCb ", + " s NCCCN NCCCN s ", + " s NCCCN NCCCN s ", + " NCCCN NCCCN ", + " bCCCb bCCCb ", + " bCCCb bCCCb ", + "NbbbNNNbbNCCCb bCCCNbbNNNbbbN", + " CCCCCCCCC N N CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + "NbbbNNNbbbN NbbbNNNbbbN", + " N N N N ", + " N N N N ", + " ", + " N N N N ", + " N N N N ", + "NbbbNNNbbbN NbbbNNNbbbN", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + " CCCCCCCCC CCCCCCCCC ", + "NbbbNNNbbbN NbN NbbbNNNbbbN", + }, + { + " N N N N ", + " bCCCb bCCCb ", + " NNNbbbbbNNsNNbbbbbNNN ", + " ss bCCCb bCCCb ss ", + " s N N N N s ", + " s s ", + " N N N N N N ", + " N bCCCb bCCCb N ", + " N sbbbbbNNsNNbbbbbs N ", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + " CbC CbC N N CbC CbC ", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + "NbbbN NbbbN NbbbN NbbbN", + " NNN NNN NNN NNN ", + " NNN NNN NNN NNN ", + " s s s s ", + " NNN NNN NNN NNN ", + " NNN NNN NNN NNN ", + "NbbbN NbbbN NbbbN NbbbN", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + " CbC CbC CbC CbC ", + "NbbbN NbbbNNNNNsNsNNNNNbbbN NbbbN", + }, + { + " N N N N ", + " bCCCb bCCCb ", + " bCCCb bCCCb ", + " bCCCb bCCCb ", + " N N N N ", + " ", + " N N N N ", + " bCCCb bCCCb ", + " bCCCb bCCCb ", + "NbbbN NbbNCCCb bCCCNbbN NbbbN", + " CCC CCC N N CCC CCC ", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + "NbbbN NbbbN NbbbN NbbbN", + " N N N N ", + " N N N N ", + " ", + " N N N N ", + " N N N N ", + "NbbbN NbbbN NbbbN NbbbN", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + " CCC CCC CCC CCC ", + "NbbbN NbbbN N N NbbbN NbbbN", + }, + { + " ", + " N N N N ", + " N N N N ", + " N N N N ", + " ", + " ", + " ", + " N N N N ", + " N N N N ", + " NNN NNN N N NNN NNN ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + " ", + " ", + " ", + " NNN NNN NNN NNN ", + } }; - protected static final int DIM_TRANS_CASING = 12; protected static final int DIM_INJECTION_CASING = 13; protected static final int DIM_BRIDGE_CASING = 14; @@ -122,17 +942,31 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul private boolean isMultiChunkloaded = true; protected static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GT_MetaTileEntity_PlasmaForge> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_PlasmaForge>builder() - .addShape(STRUCTURE_PIECE_MAIN, structure_string) - .addElement('C', ofCoil(GT_MetaTileEntity_PlasmaForge::setCoilLevel, GT_MetaTileEntity_PlasmaForge::getCoilLevel)) - .addElement('b', buildHatchAdder(GT_MetaTileEntity_PlasmaForge.class) - .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Energy, ExoticEnergy, Maintenance) - .casingIndex(DIM_INJECTION_CASING) - .dot(3) - .buildAndChain(GregTech_API.sBlockCasings1, DIM_INJECTION_CASING)) - .addElement('N', ofBlock(GregTech_API.sBlockCasings1, DIM_TRANS_CASING)) - .addElement('s', ofBlock(GregTech_API.sBlockCasings1, DIM_BRIDGE_CASING)) - .build(); + private static final IStructureDefinition<GT_MetaTileEntity_PlasmaForge> STRUCTURE_DEFINITION = + StructureDefinition.<GT_MetaTileEntity_PlasmaForge>builder() + .addShape(STRUCTURE_PIECE_MAIN, structure_string) + .addElement( + 'C', + ofCoil( + GT_MetaTileEntity_PlasmaForge::setCoilLevel, + GT_MetaTileEntity_PlasmaForge::getCoilLevel)) + .addElement( + 'b', + buildHatchAdder(GT_MetaTileEntity_PlasmaForge.class) + .atLeast( + InputHatch, + OutputHatch, + InputBus, + OutputBus, + Energy, + ExoticEnergy, + Maintenance) + .casingIndex(DIM_INJECTION_CASING) + .dot(3) + .buildAndChain(GregTech_API.sBlockCasings1, DIM_INJECTION_CASING)) + .addElement('N', ofBlock(GregTech_API.sBlockCasings1, DIM_TRANS_CASING)) + .addElement('s', ofBlock(GregTech_API.sBlockCasings1, DIM_BRIDGE_CASING)) + .build(); @Override protected boolean addBottomHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { @@ -157,26 +991,42 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul protected GT_Multiblock_Tooltip_Builder createTooltip() { GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addInfo("Transcending Dimensional Boundaries.") - .addInfo("Takes " + EnumChatFormatting.RED + GT_Utility.formatNumbers(max_efficiency_time_in_ticks/(3600*20)) + EnumChatFormatting.GRAY + " hours of continuous run time to fully breach dimensional") - .addInfo("boundaries and achieve maximum efficiency. This reduces fuel") - .addInfo("consumption by up to " + EnumChatFormatting.RED + GT_Utility.formatNumbers(100*maximum_discount) + "%" + EnumChatFormatting.GRAY + ". Supports overclocking beyond MAX voltage.") - .addInfo(AuthorColen) - .addSeparator() - .beginStructureBlock(33, 24, 33, false) - .addStructureInfo("DTPF Structure is too complex! See schematic for details.") - .addStructureInfo(EnumChatFormatting.GOLD + "2112" + EnumChatFormatting.GRAY + " Heating coils required.") - .addStructureInfo(EnumChatFormatting.GOLD + "120" + EnumChatFormatting.GRAY + " Dimensional bridge blocks required.") - .addStructureInfo(EnumChatFormatting.GOLD + "1270" + EnumChatFormatting.GRAY + " Dimensional injection casings required.") - .addStructureInfo(EnumChatFormatting.GOLD + "2121" + EnumChatFormatting.GRAY + " Dimensionally transcendent casings required.") - .addStructureInfo("--------------------------------------------") - .addStructureInfo("Requires " + EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "-" + EnumChatFormatting.GOLD + "2" + EnumChatFormatting.GRAY + " energy hatches or " + EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + " TT energy hatch.") - .addStructureInfo("Requires " + EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + " maintenance hatch.") - .addStructureInfo("Requires " + EnumChatFormatting.GOLD + min_input_hatch + EnumChatFormatting.GRAY + "-" + EnumChatFormatting.GOLD + max_input_hatch + EnumChatFormatting.GRAY + " input hatches.") - .addStructureInfo("Requires " + EnumChatFormatting.GOLD + min_output_hatch + EnumChatFormatting.GRAY + "-" + EnumChatFormatting.GOLD + max_output_hatch + EnumChatFormatting.GRAY + " output hatches.") - .addStructureInfo("Requires " + EnumChatFormatting.GOLD + min_input_bus + EnumChatFormatting.GRAY + "-" + EnumChatFormatting.GOLD + max_input_bus + EnumChatFormatting.GRAY + " input busses.") - .addStructureInfo("Requires " + EnumChatFormatting.GOLD + min_output_bus + EnumChatFormatting.GRAY + "-" + EnumChatFormatting.GOLD + max_input_bus + EnumChatFormatting.GRAY + " output busses.") - .addStructureInfo("--------------------------------------------") - .toolTipFinisher("Gregtech"); + .addInfo("Takes " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(max_efficiency_time_in_ticks / (3600 * 20)) + EnumChatFormatting.GRAY + + " hours of continuous run time to fully breach dimensional") + .addInfo("boundaries and achieve maximum efficiency. This reduces fuel") + .addInfo("consumption by up to " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(100 * maximum_discount) + "%" + EnumChatFormatting.GRAY + + ". Supports overclocking beyond MAX voltage.") + .addInfo(AuthorColen) + .addSeparator() + .beginStructureBlock(33, 24, 33, false) + .addStructureInfo("DTPF Structure is too complex! See schematic for details.") + .addStructureInfo( + EnumChatFormatting.GOLD + "2112" + EnumChatFormatting.GRAY + " Heating coils required.") + .addStructureInfo(EnumChatFormatting.GOLD + "120" + EnumChatFormatting.GRAY + + " Dimensional bridge blocks required.") + .addStructureInfo(EnumChatFormatting.GOLD + "1270" + EnumChatFormatting.GRAY + + " Dimensional injection casings required.") + .addStructureInfo(EnumChatFormatting.GOLD + "2121" + EnumChatFormatting.GRAY + + " Dimensionally transcendent casings required.") + .addStructureInfo("--------------------------------------------") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "-" + + EnumChatFormatting.GOLD + "2" + EnumChatFormatting.GRAY + " energy hatches or " + + EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + " TT energy hatch.") + .addStructureInfo( + "Requires " + EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + " maintenance hatch.") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + min_input_hatch + EnumChatFormatting.GRAY + + "-" + EnumChatFormatting.GOLD + max_input_hatch + EnumChatFormatting.GRAY + " input hatches.") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + min_output_hatch + EnumChatFormatting.GRAY + + "-" + EnumChatFormatting.GOLD + max_output_hatch + EnumChatFormatting.GRAY + + " output hatches.") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + min_input_bus + EnumChatFormatting.GRAY + "-" + + EnumChatFormatting.GOLD + max_input_bus + EnumChatFormatting.GRAY + " input busses.") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + min_output_bus + EnumChatFormatting.GRAY + "-" + + EnumChatFormatting.GOLD + max_input_bus + EnumChatFormatting.GRAY + " output busses.") + .addStructureInfo("--------------------------------------------") + .toolTipFinisher("Gregtech"); return tt; } @@ -187,27 +1037,43 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { if (aActive) - return new ITexture[]{ + return new ITexture[] { casingTexturePages[0][DIM_BRIDGE_CASING], - TextureFactory.builder().addIcon(OVERLAY_DTPF_ON).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FUSION1_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + TextureFactory.builder() + .addIcon(OVERLAY_DTPF_ON) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FUSION1_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { casingTexturePages[0][DIM_BRIDGE_CASING], - TextureFactory.builder().addIcon(OVERLAY_DTPF_OFF).extFacing().build()}; + TextureFactory.builder().addIcon(OVERLAY_DTPF_OFF).extFacing().build() + }; } - return new ITexture[]{casingTexturePages[0][DIM_BRIDGE_CASING]}; + return new ITexture[] {casingTexturePages[0][DIM_BRIDGE_CASING]}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "PlasmaForge.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "PlasmaForge.png"); } @Override - public int getPollutionPerSecond(ItemStack aStack){ + public int getPollutionPerSecond(ItemStack aStack) { return 0; } @@ -253,20 +1119,13 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul // Look up recipe. If not found it will return null. GT_Recipe tRecipe_0 = GT_Recipe.GT_Recipe_Map.sPlasmaForgeRecipes.findRecipe( - getBaseMetaTileEntity(), - false, - tTotalEU, - tFluids, - tItems - ); + getBaseMetaTileEntity(), false, tTotalEU, tFluids, tItems); // Check if recipe found. - if (tRecipe_0 == null) - return false; + if (tRecipe_0 == null) return false; // If coil heat capacity is too low, refuse to start recipe. - if (mHeatingCapacity <= tRecipe_0.mSpecialValue) - return false; + if (mHeatingCapacity <= tRecipe_0.mSpecialValue) return false; // Reduce fuel quantity if machine has been running for long enough. GT_Recipe tRecipe_1 = tRecipe_0.copy(); @@ -287,11 +1146,8 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul } } - // Takes items/fluids from hatches/busses. - if (!tRecipe_1.isRecipeInputEqual(true, tFluids, tItems)) - return false; - + if (!tRecipe_1.isRecipeInputEqual(true, tFluids, tItems)) return false; // Logic for overclocking calculations. double EU_input_tier = log(tTotalEU) / log4; @@ -324,27 +1180,21 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul setCoilLevel(HeatingCoilLevel.None); // Check the main structure - if (!checkPiece(STRUCTURE_PIECE_MAIN, 16, 21, 16)) - return false; + if (!checkPiece(STRUCTURE_PIECE_MAIN, 16, 21, 16)) return false; - if (getCoilLevel() == HeatingCoilLevel.None) - return false; + if (getCoilLevel() == HeatingCoilLevel.None) return false; // Item input bus check. - if ((mInputBusses.size() < min_input_bus) || (mInputBusses.size() > max_input_bus)) - return false; + if ((mInputBusses.size() < min_input_bus) || (mInputBusses.size() > max_input_bus)) return false; // Item output bus check. - if ((mOutputBusses.size() < min_output_bus) || (mOutputBusses.size() > max_output_bus)) - return false; + if ((mOutputBusses.size() < min_output_bus) || (mOutputBusses.size() > max_output_bus)) return false; // Fluid input hatch check. - if ((mInputHatches.size() < min_input_hatch) || (mInputHatches.size() > max_input_hatch)) - return false; + if ((mInputHatches.size() < min_input_hatch) || (mInputHatches.size() > max_input_hatch)) return false; // Fluid output hatch check. - if ((mOutputHatches.size() < min_output_hatch) || (mOutputHatches.size() > max_output_hatch)) - return false; + if ((mOutputHatches.size() < min_output_hatch) || (mOutputHatches.size() > max_output_hatch)) return false; // If there is more than 1 TT energy hatch, the structure check will fail. // If there is a TT hatch and a normal hatch, the structure check will fail. @@ -359,18 +1209,18 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul // Check will also fail if energy hatches are not of the same tier. byte tier_of_hatch = mEnergyHatches.get(0).mTier; - for(GT_MetaTileEntity_Hatch_Energy energyHatch : mEnergyHatches) { - if (energyHatch.mTier != tier_of_hatch) { return false; } + for (GT_MetaTileEntity_Hatch_Energy energyHatch : mEnergyHatches) { + if (energyHatch.mTier != tier_of_hatch) { + return false; + } } } // If there are no energy hatches or TT energy hatches, structure will fail to form. - if ((mEnergyHatches.size() == 0) && (mExoticEnergyHatches.size() == 0)) - return false; + if ((mEnergyHatches.size() == 0) && (mExoticEnergyHatches.size() == 0)) return false; // One maintenance hatch only. Mandatory. - if (mMaintenanceHatches.size() != 1) - return false; + if (mMaintenanceHatches.size() != 1) return false; // Heat capacity of coils used on multi. No free heat from extra EU! mHeatingCapacity = (int) getCoilLevel().getHeat(); @@ -386,12 +1236,10 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul @Override public boolean addOutput(FluidStack aLiquid) { - if (aLiquid == null) - return false; + if (aLiquid == null) return false; FluidStack tLiquid = aLiquid.copy(); - return dumpFluid(mOutputHatches, tLiquid, true) || - dumpFluid(mOutputHatches, tLiquid, false); + return dumpFluid(mOutputHatches, tLiquid, true) || dumpFluid(mOutputHatches, tLiquid, false); } @Override @@ -416,33 +1264,45 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul @Override public String[] getInfoData() { - long storedEnergy=0; - long maxEnergy=0; + long storedEnergy = 0; + long maxEnergy = 0; - for(GT_MetaTileEntity_Hatch tHatch : mExoticEnergyHatches) { + for (GT_MetaTileEntity_Hatch tHatch : mExoticEnergyHatches) { if (isValidMetaTileEntity(tHatch)) { - storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } } - return new String[]{ + return new String[] { "------------ Critical Information ------------", - StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime) + EnumChatFormatting.RESET + "t / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime) + EnumChatFormatting.RESET + "t", - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", - StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(-EU_per_tick) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti(getExoticAndNormalEnergyHatchList())) + EnumChatFormatting.RESET + " EU/t(*" + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(GT_ExoticEnergyInputHelper.getMaxInputAmpsMulti(getExoticAndNormalEnergyHatchList())) + EnumChatFormatting.RESET + "A) " + - StatCollector.translateToLocal("GT5U.machines.tier") + ": " + - EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti(getExoticAndNormalEnergyHatchList()))] + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.EBF.heat") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mHeatingCapacity) + EnumChatFormatting.RESET + " K", - "Ticks run: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(running_time) + EnumChatFormatting.RESET + ", Fuel Discount: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(100 * (1-discount)) + EnumChatFormatting.RESET + "%", + StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mProgresstime) + EnumChatFormatting.RESET + "t / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxProgresstime) + EnumChatFormatting.RESET + "t", + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(-EU_per_tick) + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers( + GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti(getExoticAndNormalEnergyHatchList())) + + EnumChatFormatting.RESET + " EU/t(*" + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers( + GT_ExoticEnergyInputHelper.getMaxInputAmpsMulti(getExoticAndNormalEnergyHatchList())) + + EnumChatFormatting.RESET + "A) " + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + EnumChatFormatting.YELLOW + + VN[ + GT_Utility.getTier(GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti( + getExoticAndNormalEnergyHatchList()))] + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.EBF.heat") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mHeatingCapacity) + EnumChatFormatting.RESET + " K", + "Ticks run: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(running_time) + EnumChatFormatting.RESET + + ", Fuel Discount: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(100 * (1 - discount)) + + EnumChatFormatting.RESET + "%", "-----------------------------------------" }; } @@ -474,15 +1334,33 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul int ControllerXCoordinate = ((TileEntity) aBaseMetaTileEntity).xCoord; int ControllerZCoordinate = ((TileEntity) aBaseMetaTileEntity).zCoord; - GT_ChunkManager.requestChunkLoad((TileEntity) aBaseMetaTileEntity, new ChunkCoordIntPair(ControllerXCoordinate, ControllerZCoordinate)); - GT_ChunkManager.requestChunkLoad((TileEntity) aBaseMetaTileEntity, new ChunkCoordIntPair(ControllerXCoordinate + 16, ControllerZCoordinate)); - GT_ChunkManager.requestChunkLoad((TileEntity) aBaseMetaTileEntity, new ChunkCoordIntPair(ControllerXCoordinate - 16, ControllerZCoordinate)); - GT_ChunkManager.requestChunkLoad((TileEntity) aBaseMetaTileEntity, new ChunkCoordIntPair(ControllerXCoordinate, ControllerZCoordinate + 16)); - GT_ChunkManager.requestChunkLoad((TileEntity) aBaseMetaTileEntity, new ChunkCoordIntPair(ControllerXCoordinate, ControllerZCoordinate - 16)); - GT_ChunkManager.requestChunkLoad((TileEntity) aBaseMetaTileEntity, new ChunkCoordIntPair(ControllerXCoordinate + 16, ControllerZCoordinate + 16)); - GT_ChunkManager.requestChunkLoad((TileEntity) aBaseMetaTileEntity, new ChunkCoordIntPair(ControllerXCoordinate + 16, ControllerZCoordinate - 16)); - GT_ChunkManager.requestChunkLoad((TileEntity) aBaseMetaTileEntity, new ChunkCoordIntPair(ControllerXCoordinate - 16, ControllerZCoordinate + 16)); - GT_ChunkManager.requestChunkLoad((TileEntity) aBaseMetaTileEntity, new ChunkCoordIntPair(ControllerXCoordinate - 16, ControllerZCoordinate - 16)); + GT_ChunkManager.requestChunkLoad( + (TileEntity) aBaseMetaTileEntity, + new ChunkCoordIntPair(ControllerXCoordinate, ControllerZCoordinate)); + GT_ChunkManager.requestChunkLoad( + (TileEntity) aBaseMetaTileEntity, + new ChunkCoordIntPair(ControllerXCoordinate + 16, ControllerZCoordinate)); + GT_ChunkManager.requestChunkLoad( + (TileEntity) aBaseMetaTileEntity, + new ChunkCoordIntPair(ControllerXCoordinate - 16, ControllerZCoordinate)); + GT_ChunkManager.requestChunkLoad( + (TileEntity) aBaseMetaTileEntity, + new ChunkCoordIntPair(ControllerXCoordinate, ControllerZCoordinate + 16)); + GT_ChunkManager.requestChunkLoad( + (TileEntity) aBaseMetaTileEntity, + new ChunkCoordIntPair(ControllerXCoordinate, ControllerZCoordinate - 16)); + GT_ChunkManager.requestChunkLoad( + (TileEntity) aBaseMetaTileEntity, + new ChunkCoordIntPair(ControllerXCoordinate + 16, ControllerZCoordinate + 16)); + GT_ChunkManager.requestChunkLoad( + (TileEntity) aBaseMetaTileEntity, + new ChunkCoordIntPair(ControllerXCoordinate + 16, ControllerZCoordinate - 16)); + GT_ChunkManager.requestChunkLoad( + (TileEntity) aBaseMetaTileEntity, + new ChunkCoordIntPair(ControllerXCoordinate - 16, ControllerZCoordinate + 16)); + GT_ChunkManager.requestChunkLoad( + (TileEntity) aBaseMetaTileEntity, + new ChunkCoordIntPair(ControllerXCoordinate - 16, ControllerZCoordinate - 16)); isMultiChunkloaded = true; } @@ -492,7 +1370,7 @@ public class GT_MetaTileEntity_PlasmaForge extends GT_MetaTileEntity_AbstractMul @Override public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 16,21,16); + buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 16, 21, 16); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java index 955bc3620b..e53bf880ba 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; @@ -23,8 +25,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEntity { public static final int INPUT_SLOTS = 3, OUTPUT_SLOTS = 3; @@ -38,11 +38,11 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn @Deprecated public ItemStack mOutputItem1; + @Deprecated public ItemStack mOutputItem2; - public GT_MetaTileEntity_PrimitiveBlastFurnace(int aID, String aName, - String aNameRegional) { + public GT_MetaTileEntity_PrimitiveBlastFurnace(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, INPUT_SLOTS + OUTPUT_SLOTS); } @@ -118,7 +118,8 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn @Override public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return (GregTech_API.getCoverBehaviorNew(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); + return (GregTech_API.getCoverBehaviorNew(aCoverID.toStack()).isSimpleCover()) + && (super.allowCoverOnSide(aSide, aCoverID)); } @Override @@ -151,8 +152,7 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, - EntityPlayer aPlayer) { + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) { return true; } @@ -161,35 +161,39 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, - IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_PrimitiveBlastFurnace(aPlayerInventory, - aBaseMetaTileEntity); + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_PrimitiveBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, - IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_PrimitiveBlastFurnace(aPlayerInventory, - aBaseMetaTileEntity, getName(), - GT_Recipe.GT_Recipe_Map.sPrimitiveBlastRecipes.mNEIName); + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_PrimitiveBlastFurnace( + aPlayerInventory, + aBaseMetaTileEntity, + getName(), + GT_Recipe.GT_Recipe_Map.sPrimitiveBlastRecipes.mNEIName); } private boolean checkMachine() { - int xDir = - ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; - int zDir = - ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; + int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; for (int i = -1; i < 2; i++) { for (int j = -1; j < 3; j++) { for (int k = -1; k < 2; k++) { if ((xDir + i != 0) || (j != 0) || (zDir + k != 0)) { if ((i != 0) || (j == -1) || (k != 0)) { - if (!isCorrectCasingBlock(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k)) || !isCorrectCasingMetaID(getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k))) { + if (!isCorrectCasingBlock(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k)) + || !isCorrectCasingMetaID( + getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k))) { mChimneyBlocked = false; return false; } - } else if ((!GT_Utility.arrayContains(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k), Blocks.lava, Blocks.flowing_lava, null)) && (!getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) { + } else if ((!GT_Utility.arrayContains( + getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k), + Blocks.lava, + Blocks.flowing_lava, + null)) + && (!getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) { mChimneyBlocked = true; return false; } @@ -211,16 +215,20 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, - long aTimer) { - final int lavaX = - aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1); - final int lavaZ = - aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1); + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + final int lavaX = aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1); + final int lavaZ = aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { - new WorldSpawnedEventBuilder.ParticleEventBuilder().setMotion(0D, - 0.3D, 0D).setIdentifier(ParticleFX.LARGE_SMOKE).setPosition(lavaX + XSTR_INSTANCE.nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), lavaZ + XSTR_INSTANCE.nextFloat()).setWorld(getBaseMetaTileEntity().getWorld()).run(); + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setMotion(0D, 0.3D, 0D) + .setIdentifier(ParticleFX.LARGE_SMOKE) + .setPosition( + lavaX + XSTR_INSTANCE.nextFloat(), + aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), + lavaZ + XSTR_INSTANCE.nextFloat()) + .setWorld(getBaseMetaTileEntity().getWorld()) + .run(); } if (aBaseMetaTileEntity.isServerSide()) { if (this.mUpdate-- == 0) { @@ -233,46 +241,47 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn this.mOutputItems = null; this.mProgresstime = 0; this.mMaxProgresstime = 0; - GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "steel"); + GT_Mod.achievements.issueAchievement( + aBaseMetaTileEntity + .getWorld() + .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), + "steel"); } } else if (aBaseMetaTileEntity.isAllowedToWork()) { checkRecipe(); } } if (this.mMaxProgresstime > 0 && (aTimer % 20L == 0L)) { - GT_Pollution.addPollution(this.getBaseMetaTileEntity(), - GT_Mod.gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond); + GT_Pollution.addPollution( + this.getBaseMetaTileEntity(), GT_Mod.gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond); } aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine)); final short lavaY = aBaseMetaTileEntity.getYCoord(); if (aBaseMetaTileEntity.isActive()) { if (aBaseMetaTileEntity.getAir(lavaX, lavaY, lavaZ)) { - aBaseMetaTileEntity.getWorld().setBlock(lavaX, lavaY, - lavaZ, Blocks.lava, 1, 2); + aBaseMetaTileEntity.getWorld().setBlock(lavaX, lavaY, lavaZ, Blocks.lava, 1, 2); this.mUpdate = 1; } if (aBaseMetaTileEntity.getAir(lavaX, lavaY + 1, lavaZ)) { - aBaseMetaTileEntity.getWorld().setBlock(lavaX, lavaY + 1, - lavaZ, Blocks.lava, 1, 2); + aBaseMetaTileEntity.getWorld().setBlock(lavaX, lavaY + 1, lavaZ, Blocks.lava, 1, 2); this.mUpdate = 1; } } else { - Block lowerLava = aBaseMetaTileEntity.getBlock(lavaX, lavaY, - lavaZ); - Block upperLava = aBaseMetaTileEntity.getBlock(lavaX, - lavaY + 1, lavaZ); - if (mChimneyBlocked && lowerLava == Blocks.air && upperLava == Blocks.air && aBaseMetaTileEntity.getAir(lavaX, lavaY + 2, lavaZ)) { + Block lowerLava = aBaseMetaTileEntity.getBlock(lavaX, lavaY, lavaZ); + Block upperLava = aBaseMetaTileEntity.getBlock(lavaX, lavaY + 1, lavaZ); + if (mChimneyBlocked + && lowerLava == Blocks.air + && upperLava == Blocks.air + && aBaseMetaTileEntity.getAir(lavaX, lavaY + 2, lavaZ)) { this.mUpdate = 0; } if (lowerLava == Blocks.lava) { - aBaseMetaTileEntity.getWorld().setBlock(lavaX, lavaY, - lavaZ, Blocks.air, 0, 2); + aBaseMetaTileEntity.getWorld().setBlock(lavaX, lavaY, lavaZ, Blocks.air, 0, 2); this.mUpdate = 1; } if (upperLava == Blocks.lava) { - aBaseMetaTileEntity.getWorld().setBlock(lavaX, lavaY + 1, - lavaZ, Blocks.air, 0, 2); + aBaseMetaTileEntity.getWorld().setBlock(lavaX, lavaY + 1, lavaZ, Blocks.air, 0, 2); this.mUpdate = 1; } } @@ -293,14 +302,11 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn final byte frontFacing = aBaseMetaTileEntity.getFrontFacing(); - final double oX = - aBaseMetaTileEntity.getOffsetX(frontFacing, 1) + 0.5D; + final double oX = aBaseMetaTileEntity.getOffsetX(frontFacing, 1) + 0.5D; final double oY = aBaseMetaTileEntity.getOffsetY(frontFacing, 1); - final double oZ = - aBaseMetaTileEntity.getOffsetZ(frontFacing, 1) + 0.5D; + final double oZ = aBaseMetaTileEntity.getOffsetZ(frontFacing, 1) + 0.5D; final double offset = -0.48D; - final double horizontal = - XSTR_INSTANCE.nextFloat() * 8D / 16D - 4D / 16D; + final double horizontal = XSTR_INSTANCE.nextFloat() * 8D / 16D - 4D / 16D; final double x, y, z; @@ -321,8 +327,10 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn z = oZ + offset; } - ParticleEventBuilder particleEventBuilder = - (new ParticleEventBuilder()).setMotion(0D, 0D, 0D).setPosition(x, y, z).setWorld(getBaseMetaTileEntity().getWorld()); + ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder()) + .setMotion(0D, 0D, 0D) + .setPosition(x, y, z) + .setWorld(getBaseMetaTileEntity().getWorld()); particleEventBuilder.setIdentifier(ParticleFX.SMOKE).run(); particleEventBuilder.setIdentifier(ParticleFX.FLAME).run(); } @@ -341,24 +349,23 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn for (int i = 0; i < limit; i++) { int absi = INPUT_SLOTS + i; if (this.mInventory[absi] == null) { - this.mInventory[absi] = - GT_Utility.copyOrNull(this.mOutputItems[i]); - } else if (GT_Utility.areStacksEqual(this.mInventory[absi], - this.mOutputItems[i])) { - this.mInventory[absi].stackSize = - Math.min(this.mInventory[absi].getMaxStackSize(), + this.mInventory[absi] = GT_Utility.copyOrNull(this.mOutputItems[i]); + } else if (GT_Utility.areStacksEqual(this.mInventory[absi], this.mOutputItems[i])) { + this.mInventory[absi].stackSize = Math.min( + this.mInventory[absi].getMaxStackSize(), this.mInventory[absi].stackSize + this.mOutputItems[i].stackSize); } } } - private boolean spaceForOutput(ItemStack outputStack, - int relativeOutputSlot) { + private boolean spaceForOutput(ItemStack outputStack, int relativeOutputSlot) { int absoluteSlot = relativeOutputSlot + INPUT_SLOTS; if (this.mInventory[absoluteSlot] == null || outputStack == null) { return true; } - return ((this.mInventory[absoluteSlot].stackSize + outputStack.stackSize <= this.mInventory[absoluteSlot].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[absoluteSlot], outputStack))); + return ((this.mInventory[absoluteSlot].stackSize + outputStack.stackSize + <= this.mInventory[absoluteSlot].getMaxStackSize()) + && (GT_Utility.areStacksEqual(this.mInventory[absoluteSlot], outputStack))); } private boolean checkRecipe() { @@ -367,8 +374,8 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn } ItemStack[] inputs = new ItemStack[INPUT_SLOTS]; System.arraycopy(mInventory, 0, inputs, 0, INPUT_SLOTS); - GT_Recipe recipe = - GT_Recipe.GT_Recipe_Map.sPrimitiveBlastRecipes.findRecipe(getBaseMetaTileEntity(), false, 0, null, inputs); + GT_Recipe recipe = GT_Recipe.GT_Recipe_Map.sPrimitiveBlastRecipes.findRecipe( + getBaseMetaTileEntity(), false, 0, null, inputs); if (recipe == null) { this.mOutputItems = null; return false; @@ -401,14 +408,12 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, - int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return aIndex > INPUT_SLOTS; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, - int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index 4cd73dab3c..bf91c80532 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -1,5 +1,16 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.GT_HatchElement.Energy; +import static gregtech.api.enums.GT_HatchElement.Maintenance; +import static gregtech.api.enums.GT_Values.VN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_GLOW; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.isValidForLowGravity; + import com.google.common.collect.ImmutableList; import com.gtnewhorizon.structurelib.structure.IStructureElement; import gregtech.GT_Mod; @@ -20,8 +31,13 @@ import gregtech.api.util.GT_ProcessingArray_Manager; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Single_Recipe_Check_Processing_Array; -import gregtech.common.blocks.GT_Item_Machines; import gregtech.api.util.GT_Utility; +import gregtech.common.blocks.GT_Item_Machines; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.stream.Stream; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -30,24 +46,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.stream.Stream; - -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.GT_HatchElement.Energy; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.enums.GT_Values.VN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_GLOW; -import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.isValidForLowGravity; - -public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMultiBlockBase<GT_MetaTileEntity_ProcessingArray> { +public class GT_MetaTileEntity_ProcessingArray + extends GT_MetaTileEntity_CubicMultiBlockBase<GT_MetaTileEntity_ProcessingArray> { private GT_Recipe_Map mLastRecipeMap; private GT_Recipe mLastRecipe; @@ -97,30 +97,55 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu @Override public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - return super.addToMachineList(aTileEntity, aBaseCasingIndex) || addExoticEnergyInputToMachineList(aTileEntity, aBaseCasingIndex); + return super.addToMachineList(aTileEntity, aBaseCasingIndex) + || addExoticEnergyInputToMachineList(aTileEntity, aBaseCasingIndex); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { - if (aActive) return new ITexture[]{ - BlockIcons.casingTexturePages[0][48], - TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + if (aActive) + return new ITexture[] { BlockIcons.casingTexturePages[0][48], - TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + BlockIcons.casingTexturePages[0][48], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PROCESSING_ARRAY) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][48]}; + return new ITexture[] {Textures.BlockIcons.casingTexturePages[0][48]}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ProcessingArray.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ProcessingArray.png"); } - //TODO: Expand so it also does the non recipe map recipes + // TODO: Expand so it also does the non recipe map recipes /* public void remoteRecipeCheck() { if (mInventory[1] == null) return; @@ -143,12 +168,12 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu } */ - //Gets the recipe map for the given machine through its unlocalized name + // Gets the recipe map for the given machine through its unlocalized name @Override public GT_Recipe_Map getRecipeMap() { if (isCorrectMachinePart(mInventory[1])) { int length = mInventory[1].getUnlocalizedName().length(); - String aMachineName = mInventory[1].getUnlocalizedName().substring(17,length-8); + String aMachineName = mInventory[1].getUnlocalizedName().substring(17, length - 8); return GT_ProcessingArray_Manager.giveRecipeMap(aMachineName); } return null; @@ -183,26 +208,25 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu if (mLastRecipe == null) { IMetaTileEntity aMachine = GT_Item_Machines.getMetaTileEntity(mInventory[1]); - if (aMachine!=null) - tTier = ((GT_MetaTileEntity_TieredMachineBlock) aMachine).mTier; + if (aMachine != null) tTier = ((GT_MetaTileEntity_TieredMachineBlock) aMachine).mTier; mMult = 0; - if (downtierUEV && tTier>9){ - switch(tTier){ + if (downtierUEV && tTier > 9) { + switch (tTier) { default: - tTier=0; + tTier = 0; break; case 10: - tTier=9; - mMult=2; //Parallels are 4x as strong and require 4x less EU/t + tTier = 9; + mMult = 2; // Parallels are 4x as strong and require 4x less EU/t case 11: - tTier=9; - mMult=4; //Parallels are 16x as strong and require 16x less EU/t + tTier = 9; + mMult = 4; // Parallels are 16x as strong and require 16x less EU/t case 12: case 13: case 14: case 15: - tTier=9; - mMult=6; //Parallels are 64x as strong and require 64x less EU/t + tTier = 9; + mMult = 6; // Parallels are 64x as strong and require 64x less EU/t } } } @@ -213,14 +237,11 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { IGregTechTileEntity tInputBus = tHatch.getBaseMetaTileEntity(); for (int i = tInputBus.getSizeInventory() - 1; i >= 0; i--) { - if (tInputBus.getStackInSlot(i) != null) - tInputList.add(tInputBus.getStackInSlot(i)); + if (tInputBus.getStackInSlot(i) != null) tInputList.add(tInputBus.getStackInSlot(i)); } ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]); - if (processRecipe(tInputs, tFluids, map)) - return true; - else - tInputList.clear(); + if (processRecipe(tInputs, tFluids, map)) return true; + else tInputList.clear(); } } else { ArrayList<ItemStack> tInputList = getStoredInputs(); @@ -231,7 +252,8 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu } public boolean processLockedRecipe() { - GT_Single_Recipe_Check_Processing_Array tSingleRecipeCheck = (GT_Single_Recipe_Check_Processing_Array) mSingleRecipeCheck; + GT_Single_Recipe_Check_Processing_Array tSingleRecipeCheck = + (GT_Single_Recipe_Check_Processing_Array) mSingleRecipeCheck; int machines = mInventory[1].stackSize << mMult; int parallel = tSingleRecipeCheck.checkRecipeInputs(true, machines); @@ -241,17 +263,20 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu public boolean processRecipe(ItemStack[] tInputs, FluidStack[] tFluids, GT_Recipe.GT_Recipe_Map map) { if (tInputs.length <= 0 && tFluids.length <= 0) return false; - GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + GT_Recipe tRecipe = map.findRecipe( + getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); if (tRecipe == null) return false; - if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && - !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId)) + if (GT_Mod.gregtechproxy.mLowGravProcessing + && tRecipe.mSpecialValue == -100 + && !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId)) return false; GT_Single_Recipe_Check_Processing_Array.Builder tSingleRecipeCheckBuilder = null; if (mLockedToSingleRecipe) { // We're locked to a single recipe, but haven't built the recipe checker yet. // Build the checker on next successful recipe. - tSingleRecipeCheckBuilder = GT_Single_Recipe_Check_Processing_Array.processingArrayBuilder(this).setBefore(); + tSingleRecipeCheckBuilder = GT_Single_Recipe_Check_Processing_Array.processingArrayBuilder(this) + .setBefore(); } boolean recipeLocked = false; @@ -263,12 +288,11 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu break; } else if (mLockedToSingleRecipe && !recipeLocked) { // We want to lock to a single run of the recipe. - mSingleRecipeCheck = - tSingleRecipeCheckBuilder - .setAfter() - .setRecipe(tRecipe) - .setRecipeAmperage(map.mAmperage) - .build(); + mSingleRecipeCheck = tSingleRecipeCheckBuilder + .setAfter() + .setRecipe(tRecipe) + .setRecipeAmperage(map.mAmperage) + .build(); recipeLocked = true; } } @@ -288,12 +312,10 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; calculateOverclockedNessMulti(aRecipe.mEUt, aRecipe.mDuration, aAmperage, GT_Values.V[tTier]); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; + // In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; this.mEUt = GT_Utility.safeInt(((long) this.mEUt * parallel) >> mMult, 1); - if (mEUt == Integer.MAX_VALUE - 1) - return false; + if (mEUt == Integer.MAX_VALUE - 1) return false; if (this.mEUt > 0) { this.mEUt = (-this.mEUt); @@ -325,7 +347,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu .flatMap(GT_MetaTileEntity_ProcessingArray::splitOversizedStack) .filter(is -> is.stackSize > 0) .toArray(ItemStack[]::new); - this.mOutputFluids = new FluidStack[]{tFOut}; + this.mOutputFluids = new FluidStack[] {tFOut}; updateSlots(); return true; } @@ -394,12 +416,14 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } else { mSeparate = !mSeparate; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + mSeparate); + GT_Utility.sendChatToPlayer( + aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + mSeparate); } } @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) { downtierUEV = !downtierUEV; mLastRecipe = null; // clears last recipe GT_Utility.sendChatToPlayer(aPlayer, "Treat UEV+ machines as multiple UHV " + downtierUEV); @@ -423,7 +447,8 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu @Override protected List<IHatchElement<? super GT_MetaTileEntity_CubicMultiBlockBase<?>>> getAllowedHatches() { - return ImmutableList.of(InputHatch, OutputHatch, InputBus, OutputBus, Muffler, Maintenance, Energy, ExoticEnergy); + return ImmutableList.of( + InputHatch, OutputHatch, InputBus, OutputBus, Muffler, Maintenance, Energy, ExoticEnergy); } @Override @@ -439,38 +464,50 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu @Override public String[] getInfoData() { - long storedEnergy=0; - long maxEnergy=0; - for(GT_MetaTileEntity_Hatch tHatch : mExoticEnergyHatches) { + long storedEnergy = 0; + long maxEnergy = 0; + for (GT_MetaTileEntity_Hatch tHatch : mExoticEnergyHatches) { if (isValidMetaTileEntity(tHatch)) { - storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } } - return new String[]{ - StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", - StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + - EnumChatFormatting.RED + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti(getExoticAndNormalEnergyHatchList())) + EnumChatFormatting.RESET + " EU/t(*" + GT_Utility.formatNumbers(GT_ExoticEnergyInputHelper.getMaxInputAmpsMulti(getExoticAndNormalEnergyHatchList())) + "A) " + - StatCollector.translateToLocal("GT5U.machines.tier") + ": " + - EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti(getExoticAndNormalEnergyHatchList()))] + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + - EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + - StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " + - EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - StatCollector.translateToLocal("GT5U.PA.machinetier") + ": " + - EnumChatFormatting.GREEN + tTier + EnumChatFormatting.RESET + " " + - StatCollector.translateToLocal("GT5U.PA.discount") + ": " + - EnumChatFormatting.GREEN + (1 << mMult) + EnumChatFormatting.RESET + " x", - StatCollector.translateToLocal("GT5U.PA.parallel") + ": " + - EnumChatFormatting.GREEN + GT_Utility.formatNumbers((mInventory[1] != null) ? (mInventory[1].stackSize << mMult) : 0) + EnumChatFormatting.RESET + return new String[] { + StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(maxEnergy) + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(-mEUt) + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers( + GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti(getExoticAndNormalEnergyHatchList())) + + EnumChatFormatting.RESET + " EU/t(*" + + GT_Utility.formatNumbers( + GT_ExoticEnergyInputHelper.getMaxInputAmpsMulti(getExoticAndNormalEnergyHatchList())) + + "A) " + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + EnumChatFormatting.YELLOW + + VN[ + GT_Utility.getTier(GT_ExoticEnergyInputHelper.getMaxInputVoltageMulti( + getExoticAndNormalEnergyHatchList()))] + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + EnumChatFormatting.YELLOW + + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + StatCollector.translateToLocal("GT5U.PA.machinetier") + ": " + EnumChatFormatting.GREEN + + tTier + EnumChatFormatting.RESET + " " + StatCollector.translateToLocal("GT5U.PA.discount") + + ": " + EnumChatFormatting.GREEN + + (1 << mMult) + EnumChatFormatting.RESET + " x", + StatCollector.translateToLocal("GT5U.PA.parallel") + ": " + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers((mInventory[1] != null) ? (mInventory[1].stackSize << mMult) : 0) + + EnumChatFormatting.RESET }; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java index 16a655b20c..26c538e20b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java @@ -1,5 +1,18 @@ package gregtech.common.tileentities.machines.multi; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockUnlocalizedName; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.GT_HatchElement.*; +import static gregtech.api.enums.GT_Values.MOD_ID_DC; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_GLOW; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofCoil; + import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -27,55 +40,52 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockUnlocalizedName; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GT_HatchElement.*; -import static gregtech.api.enums.GT_Values.MOD_ID_DC; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_GLOW; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.ofCoil; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_PyrolyseOven> implements ISurvivalConstructable { +public class GT_MetaTileEntity_PyrolyseOven + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_PyrolyseOven> + implements ISurvivalConstructable { private HeatingCoilLevel coilHeat; - //public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0, Dyes.MACHINE_METAL.mRGBa); + // public static GT_CopiedBlockTexture mTextureULV = new + // GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0, + // Dyes.MACHINE_METAL.mRGBa); private static final int CASING_INDEX = 1090; - private static final IStructureDefinition<GT_MetaTileEntity_PyrolyseOven> STRUCTURE_DEFINITION = createStructureDefinition(); + private static final IStructureDefinition<GT_MetaTileEntity_PyrolyseOven> STRUCTURE_DEFINITION = + createStructureDefinition(); private static IStructureDefinition<GT_MetaTileEntity_PyrolyseOven> createStructureDefinition() { - IStructureElement<GT_MetaTileEntity_PyrolyseOven> tCasingElement = - Loader.isModLoaded(MOD_ID_DC) ? - ofBlockUnlocalizedName(MOD_ID_DC, "gt.blockcasingsNH", 2) : - ofBlock(GregTech_API.sBlockCasings1, 0); + IStructureElement<GT_MetaTileEntity_PyrolyseOven> tCasingElement = Loader.isModLoaded(MOD_ID_DC) + ? ofBlockUnlocalizedName(MOD_ID_DC, "gt.blockcasingsNH", 2) + : ofBlock(GregTech_API.sBlockCasings1, 0); return StructureDefinition.<GT_MetaTileEntity_PyrolyseOven>builder() - .addShape("main", transpose(new String[][]{ - {"ccccc", "ctttc", "ctttc", "ctttc", "ccccc"}, - {"ccccc", "c---c", "c---c", "c---c", "ccccc"}, - {"ccccc", "c---c", "c---c", "c---c", "ccccc"}, - {"bb~bb", "bCCCb", "bCCCb", "bCCCb", "bbbbb"}, + .addShape("main", transpose(new String[][] { + {"ccccc", "ctttc", "ctttc", "ctttc", "ccccc"}, + {"ccccc", "c---c", "c---c", "c---c", "ccccc"}, + {"ccccc", "c---c", "c---c", "c---c", "ccccc"}, + {"bb~bb", "bCCCb", "bCCCb", "bCCCb", "bbbbb"}, })) .addElement('c', onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, tCasingElement)) - .addElement('C', ofCoil(GT_MetaTileEntity_PyrolyseOven::setCoilLevel, GT_MetaTileEntity_PyrolyseOven::getCoilLevel)) - .addElement('b', buildHatchAdder(GT_MetaTileEntity_PyrolyseOven.class) - .atLeast(OutputBus, OutputHatch, Energy, Maintenance) - .casingIndex(CASING_INDEX) - .dot(1) - .buildAndChain(onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, tCasingElement)) - ) - .addElement('t', buildHatchAdder(GT_MetaTileEntity_PyrolyseOven.class) - .atLeast(InputBus, InputHatch, Muffler) - .casingIndex(CASING_INDEX) - .dot(1) - .buildAndChain(onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, tCasingElement)) - ) + .addElement( + 'C', + ofCoil( + GT_MetaTileEntity_PyrolyseOven::setCoilLevel, + GT_MetaTileEntity_PyrolyseOven::getCoilLevel)) + .addElement( + 'b', + buildHatchAdder(GT_MetaTileEntity_PyrolyseOven.class) + .atLeast(OutputBus, OutputHatch, Energy, Maintenance) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain( + onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, tCasingElement))) + .addElement( + 't', + buildHatchAdder(GT_MetaTileEntity_PyrolyseOven.class) + .atLeast(InputBus, InputHatch, Muffler) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain( + onElementPass(GT_MetaTileEntity_PyrolyseOven::onCasingAdded, tCasingElement))) .build(); } @@ -116,24 +126,47 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMu } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { if (aActive) - return new ITexture[]{ - BlockIcons.casingTexturePages[8][66], - TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + return new ITexture[] { BlockIcons.casingTexturePages[8][66], - TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { + BlockIcons.casingTexturePages[8][66], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PYROLYSE_OVEN) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66]}; + return new ITexture[] {Textures.BlockIcons.casingTexturePages[8][66]}; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "PyrolyseOven.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "PyrolyseOven.png"); } @Override @@ -157,8 +190,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMu ItemStack[] tInputs = getCompactedInputs(); FluidStack[] tFluids = getCompactedFluids(); - if (tInputs.length <= 0) - return false; + if (tInputs.length <= 0) return false; GT_Single_Recipe_Check.Builder tSingleRecipeCheckBuilder = null; if (mLockedToSingleRecipe) { @@ -167,13 +199,14 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMu tSingleRecipeCheckBuilder = GT_Single_Recipe_Check.builder(this).setBefore(); } - tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + tRecipe = GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.findRecipe( + getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) - return false; + if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) return false; if (mLockedToSingleRecipe) { - mSingleRecipeCheck = tSingleRecipeCheckBuilder.setAfter().setRecipe(tRecipe).build(); + mSingleRecipeCheck = + tSingleRecipeCheckBuilder.setAfter().setRecipe(tRecipe).build(); } } @@ -181,16 +214,12 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMu this.mEfficiencyIncrease = 10000; calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; - if (this.mEUt > 0) - this.mEUt = (-this.mEUt); + // In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; + if (this.mEUt > 0) this.mEUt = (-this.mEUt); this.mMaxProgresstime = Math.max(mMaxProgresstime * 2 / (1 + coilHeat.getTier()), 1); - if (tRecipe.mOutputs.length > 0) - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - if (tRecipe.mFluidOutputs.length > 0) - this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + if (tRecipe.mOutputs.length > 0) this.mOutputItems = new ItemStack[] {tRecipe.getOutput(0)}; + if (tRecipe.mFluidOutputs.length > 0) this.mOutputFluids = new FluidStack[] {tRecipe.getFluidOutput(0)}; updateSlots(); return true; } @@ -217,8 +246,10 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMu coilHeat = HeatingCoilLevel.None; mCasingAmount = 0; replaceDeprecatedCoils(aBaseMetaTileEntity); - return checkPiece("main", 2, 3, 0) && mCasingAmount >= 60 && - mMaintenanceHatches.size() == 1 && !mMufflerHatches.isEmpty(); + return checkPiece("main", 2, 3, 0) + && mCasingAmount >= 60 + && mMaintenanceHatches.size() == 1 + && !mMufflerHatches.isEmpty(); } @Override @@ -259,8 +290,8 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMu int tZ = aBaseMetaTileEntity.getZCoord() + zDir * 2; for (int xPos = tX - 1; xPos <= tX + 1; xPos++) { for (int zPos = tZ - 1; zPos <= tZ + 1; zPos++) { - if (aBaseMetaTileEntity.getBlock(xPos, tY, zPos) == GregTech_API.sBlockCasings1 && - aBaseMetaTileEntity.getMetaID(xPos, tY, zPos) == 13) { + if (aBaseMetaTileEntity.getBlock(xPos, tY, zPos) == GregTech_API.sBlockCasings1 + && aBaseMetaTileEntity.getMetaID(xPos, tY, zPos) == 13) { aBaseMetaTileEntity.getWorld().setBlock(xPos, tY, zPos, GregTech_API.sBlockCasings5, 1, 3); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java index f476e78310..5bbed8951c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java @@ -1,5 +1,11 @@ package gregtech.common.tileentities.machines.multi; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; + import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.structure.StructureUtility; import gregtech.api.GregTech_API; @@ -16,13 +22,8 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; - -public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_CubicMultiBlockBase<GT_MetaTileEntity_VacuumFreezer> { +public class GT_MetaTileEntity_VacuumFreezer + extends GT_MetaTileEntity_CubicMultiBlockBase<GT_MetaTileEntity_VacuumFreezer> { public GT_MetaTileEntity_VacuumFreezer(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -57,29 +58,52 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_CubicMult } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { ITexture[] rTexture; if (aSide == aFacing) { if (aActive) { - rTexture = new ITexture[]{ - casingTexturePages[0][17], - TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE_GLOW).extFacing().glow().build()}; + rTexture = new ITexture[] { + casingTexturePages[0][17], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; } else { - rTexture = new ITexture[]{ - casingTexturePages[0][17], - TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER_GLOW).extFacing().glow().build()}; + rTexture = new ITexture[] { + casingTexturePages[0][17], + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_VACUUM_FREEZER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_VACUUM_FREEZER_GLOW) + .extFacing() + .glow() + .build() + }; } } else { - rTexture = new ITexture[]{casingTexturePages[0][17]}; + rTexture = new ITexture[] {casingTexturePages[0][17]}; } return rTexture; } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png"); } @Override @@ -99,22 +123,23 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_CubicMult long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluidList, tInputList); + GT_Recipe tRecipe = getRecipeMap() + .findRecipe( + getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluidList, tInputList); if (tRecipe != null) { if (tRecipe.isRecipeInputEqual(true, tFluidList, tInputList)) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; + // In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; if (this.mEUt > 0) { this.mEUt = (-this.mEUt); } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + this.mOutputItems = new ItemStack[] {tRecipe.getOutput(0)}; + this.mOutputFluids = new FluidStack[] {tRecipe.getFluidOutput(0)}; updateSlots(); return true; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multiblock/MultiBlock_Macerator.java b/src/main/java/gregtech/common/tileentities/machines/multiblock/MultiBlock_Macerator.java index 23a2a484d1..09aae61527 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multiblock/MultiBlock_Macerator.java +++ b/src/main/java/gregtech/common/tileentities/machines/multiblock/MultiBlock_Macerator.java @@ -1,17 +1,5 @@ package gregtech.common.tileentities.machines.multiblock; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import com.gtnewhorizon.structurelib.util.Vec3Impl; -import gregtech.api.interfaces.ITexture; -import gregtech.api.multitileentity.multiblock.base.MultiBlockPart; -import gregtech.api.multitileentity.multiblock.base.MultiBlock_Stackable; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.common.render.GT_MultiTexture; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; - import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; @@ -24,6 +12,15 @@ import static gregtech.api.multitileentity.multiblock.base.MultiBlockPart.ITEM_I import static gregtech.api.multitileentity.multiblock.base.MultiBlockPart.ITEM_OUT; import static gregtech.api.multitileentity.multiblock.base.MultiBlockPart.NOTHING; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.util.Vec3Impl; +import gregtech.api.interfaces.ITexture; +import gregtech.api.multitileentity.multiblock.base.MultiBlock_Stackable; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import net.minecraft.block.Block; + public class MultiBlock_Macerator extends MultiBlock_Stackable<MultiBlock_Macerator> { private IStructureDefinition<MultiBlock_Macerator> STRUCTURE_DEFINITION = null; @@ -36,52 +33,59 @@ public class MultiBlock_Macerator extends MultiBlock_Stackable<MultiBlock_Macera public IStructureDefinition<MultiBlock_Macerator> getStructureDefinition() { if (STRUCTURE_DEFINITION == null) { STRUCTURE_DEFINITION = StructureDefinition.<MultiBlock_Macerator>builder() - .addShape(STACKABLE_TOP, transpose(new String[][] { - {" CCC ", "CCCCC", "CCCCC", "CCCCC", " CCC "}, - })) - .addShape(STACKABLE_MIDDLE, transpose(new String[][] { - {" BBB ", " B---B ", "DC---CD", " B---B ", " BBB "}, - })) - .addShape(STACKABLE_BOTTOM, transpose(new String[][] { - {" A~A ", "AAAAA", "AAAAA", "AAAAA", " AAA "}, - })) - .addElement('A', ofChain(addMultiTileCasing(getCasingRegistryID(), getCasingMeta(), ENERGY_IN))) - .addElement('B', ofChain(addMultiTileCasing(getCasingRegistryID(), getCasingMeta(), FLUID_IN | ITEM_IN | FLUID_OUT | ITEM_OUT))) - .addElement('C', addMultiTileCasing(getCasingRegistryID(), getCasingMeta(), NOTHING)) - .addElement('D', addMultiTileCasing(getCasingRegistryID(), getCasingMeta(), NOTHING)) - .build(); + .addShape(STACKABLE_TOP, transpose(new String[][] { + {" CCC ", "CCCCC", "CCCCC", "CCCCC", " CCC "}, + })) + .addShape(STACKABLE_MIDDLE, transpose(new String[][] { + {" BBB ", " B---B ", "DC---CD", " B---B ", " BBB "}, + })) + .addShape(STACKABLE_BOTTOM, transpose(new String[][] { + {" A~A ", "AAAAA", "AAAAA", "AAAAA", " AAA "}, + })) + .addElement('A', ofChain(addMultiTileCasing(getCasingRegistryID(), getCasingMeta(), ENERGY_IN))) + .addElement( + 'B', + ofChain(addMultiTileCasing( + getCasingRegistryID(), getCasingMeta(), FLUID_IN | ITEM_IN | FLUID_OUT | ITEM_OUT))) + .addElement('C', addMultiTileCasing(getCasingRegistryID(), getCasingMeta(), NOTHING)) + .addElement('D', addMultiTileCasing(getCasingRegistryID(), getCasingMeta(), NOTHING)) + .build(); } return STRUCTURE_DEFINITION; } - @Override public short getCasingRegistryID() { + @Override + public short getCasingRegistryID() { return getMultiTileEntityRegistryID(); } - @Override public short getCasingMeta() { + @Override + public short getCasingMeta() { return 18000; } @Override - public boolean hasTop() { return true; } - + public boolean hasTop() { + return true; + } @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Macerator") - .addInfo("Controller for the Macerator") - .addSeparator() - .beginVariableStructureBlock(7, 9, 2 + getMinStacks(), 2+getMaxStacks(), 7, 9, true) - .addController("Bottom Front Center") - .addCasingInfo("Test Casing", 60) - .addEnergyHatch("Any bottom layer casing") - .addInputHatch("Any non-optional external facing casing on the stacks") - .addInputBus("Any non-optional external facing casing on the stacks") - .addOutputHatch("Any non-optional external facing casing on the stacks") - .addOutputBus("Any non-optional external facing casing on the stacks") - .addStructureInfo(String.format("Stackable middle stacks between %d-%d time(s).", getMinStacks(), getMaxStacks())) - .toolTipFinisher("Wildcard"); + .addInfo("Controller for the Macerator") + .addSeparator() + .beginVariableStructureBlock(7, 9, 2 + getMinStacks(), 2 + getMaxStacks(), 7, 9, true) + .addController("Bottom Front Center") + .addCasingInfo("Test Casing", 60) + .addEnergyHatch("Any bottom layer casing") + .addInputHatch("Any non-optional external facing casing on the stacks") + .addInputBus("Any non-optional external facing casing on the stacks") + .addOutputHatch("Any non-optional external facing casing on the stacks") + .addOutputBus("Any non-optional external facing casing on the stacks") + .addStructureInfo( + String.format("Stackable middle stacks between %d-%d time(s).", getMinStacks(), getMaxStacks())) + .toolTipFinisher("Wildcard"); return tt; } @@ -95,7 +99,6 @@ public class MultiBlock_Macerator extends MultiBlock_Stackable<MultiBlock_Macera return 10; } - @Override public Vec3Impl getStartingStructureOffset() { return new Vec3Impl(2, 0, 0); @@ -119,19 +122,24 @@ public class MultiBlock_Macerator extends MultiBlock_Stackable<MultiBlock_Macera @Override public ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass) { // TODO: MTE(Texture) - if(mFacing == aSide) { - return new ITexture[]{ + if (mFacing == aSide) { + return new ITexture[] { // Base Texture MACHINE_CASINGS[1][0], // Active - TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE).extFacing().build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE) + .extFacing() + .build(), // Active Glow - TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW).extFacing().glow().build() + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; } // Base Texture - return new ITexture[]{ MACHINE_CASINGS[1][0]}; + return new ITexture[] {MACHINE_CASINGS[1][0]}; } - - } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Bronze.java index 821c3bfabc..129af9dc27 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Bronze.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.SoundResource; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; @@ -11,8 +13,6 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_AlloySmelter_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_AlloySmelter_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Combination Smelter", 2, 1, false); @@ -38,7 +38,12 @@ public class GT_MetaTileEntity_AlloySmelter_Bronze extends GT_MetaTileEntity_Bas @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeAlloySmelter.png", GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.mUnlocalizedName); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "BronzeAlloySmelter.png", + GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.mUnlocalizedName); } @Override @@ -61,65 +66,97 @@ public class GT_MetaTileEntity_AlloySmelter_Bronze extends GT_MetaTileEntity_Bas @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_ALLOY_SMELTER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_ALLOY_SMELTER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_ALLOY_SMELTER), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_ALLOY_SMELTER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_ALLOY_SMELTER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Steel.java index efd66a4f8f..2ad1a2ff01 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Steel.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.SoundResource; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; @@ -11,8 +13,6 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_AlloySmelter_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_AlloySmelter_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Combination Smelter", 2, 1, true); @@ -38,7 +38,12 @@ public class GT_MetaTileEntity_AlloySmelter_Steel extends GT_MetaTileEntity_Basi @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelAlloySmelter.png", GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.mUnlocalizedName); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "SteelAlloySmelter.png", + GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.mUnlocalizedName); } @Override @@ -61,65 +66,97 @@ public class GT_MetaTileEntity_AlloySmelter_Steel extends GT_MetaTileEntity_Basi @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_ALLOY_SMELTER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_ALLOY_SMELTER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_ALLOY_SMELTER), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_ALLOY_SMELTER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_ALLOY_SMELTER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Bronze.java index 9073b997ed..9fe3586790 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Bronze.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.SoundResource; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; @@ -11,8 +13,6 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_Compressor_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_Compressor_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Compressing Items", 1, 1, false); @@ -28,7 +28,12 @@ public class GT_MetaTileEntity_Compressor_Bronze extends GT_MetaTileEntity_Basic @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeCompressor.png", GT_Recipe.GT_Recipe_Map.sCompressorRecipes.mUnlocalizedName); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "BronzeCompressor.png", + GT_Recipe.GT_Recipe_Map.sCompressorRecipes.mUnlocalizedName); } @Override @@ -56,65 +61,97 @@ public class GT_MetaTileEntity_Compressor_Bronze extends GT_MetaTileEntity_Basic @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_COMPRESSOR), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_COMPRESSOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_COMPRESSOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_COMPRESSOR), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_COMPRESSOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_COMPRESSOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_COMPRESSOR), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_COMPRESSOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_COMPRESSOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_COMPRESSOR), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_COMPRESSOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_COMPRESSOR_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Steel.java index 51f44a8c77..e3781e91a8 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Steel.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.SoundResource; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; @@ -11,8 +13,6 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_Compressor_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_Compressor_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Compressing Items", 1, 1, true); @@ -28,7 +28,12 @@ public class GT_MetaTileEntity_Compressor_Steel extends GT_MetaTileEntity_BasicM @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelCompressor.png", GT_Recipe.GT_Recipe_Map.sCompressorRecipes.mUnlocalizedName); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "SteelCompressor.png", + GT_Recipe.GT_Recipe_Map.sCompressorRecipes.mUnlocalizedName); } @Override @@ -56,65 +61,97 @@ public class GT_MetaTileEntity_Compressor_Steel extends GT_MetaTileEntity_BasicM @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_COMPRESSOR), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_COMPRESSOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_COMPRESSOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_COMPRESSOR), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_COMPRESSOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_COMPRESSOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_COMPRESSOR), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_COMPRESSOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_COMPRESSOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_COMPRESSOR), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_COMPRESSOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_COMPRESSOR_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Bronze.java index 0773c09204..17fda5fc8d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Bronze.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.SoundResource; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; @@ -11,8 +13,6 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_Extractor_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_Extractor_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Extracting your first Rubber", 1, 1, false); @@ -28,7 +28,12 @@ public class GT_MetaTileEntity_Extractor_Bronze extends GT_MetaTileEntity_BasicM @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeExtractor.png", GT_Recipe.GT_Recipe_Map.sExtractorRecipes.mUnlocalizedName); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "BronzeExtractor.png", + GT_Recipe.GT_Recipe_Map.sExtractorRecipes.mUnlocalizedName); } @Override @@ -56,65 +61,97 @@ public class GT_MetaTileEntity_Extractor_Bronze extends GT_MetaTileEntity_BasicM @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_EXTRACTOR), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_EXTRACTOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_EXTRACTOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_EXTRACTOR), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_EXTRACTOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_EXTRACTOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_EXTRACTOR), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_EXTRACTOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_EXTRACTOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_EXTRACTOR), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_EXTRACTOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_EXTRACTOR_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Steel.java index d471259250..c7ebeee12b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Steel.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.SoundResource; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; @@ -11,8 +13,6 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_Extractor_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_Extractor_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Extracting your first Rubber", 1, 1, true); @@ -28,7 +28,12 @@ public class GT_MetaTileEntity_Extractor_Steel extends GT_MetaTileEntity_BasicMa @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelExtractor.png", GT_Recipe.GT_Recipe_Map.sExtractorRecipes.mUnlocalizedName); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "SteelExtractor.png", + GT_Recipe.GT_Recipe_Map.sExtractorRecipes.mUnlocalizedName); } @Override @@ -56,65 +61,97 @@ public class GT_MetaTileEntity_Extractor_Steel extends GT_MetaTileEntity_BasicMa @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_EXTRACTOR), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_EXTRACTOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_EXTRACTOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_EXTRACTOR), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_EXTRACTOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_EXTRACTOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_EXTRACTOR), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_EXTRACTOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_EXTRACTOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_EXTRACTOR), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_EXTRACTOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_EXTRACTOR_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java index eb2b91416c..a22d1cb3e3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.ParticleFX; @@ -17,9 +20,6 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.common.util.ForgeDirection; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public class GT_MetaTileEntity_ForgeHammer_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_ForgeHammer_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Forge Hammer", 1, 1, false); @@ -40,7 +40,14 @@ public class GT_MetaTileEntity_ForgeHammer_Bronze extends GT_MetaTileEntity_Basi @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeHammer.png", GT_Recipe.GT_Recipe_Map.sHammerRecipes.mUnlocalizedName, (byte) 6, (byte) 3); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "BronzeHammer.png", + GT_Recipe.GT_Recipe_Map.sHammerRecipes.mUnlocalizedName, + (byte) 6, + (byte) 3); } @Override @@ -63,66 +70,98 @@ public class GT_MetaTileEntity_ForgeHammer_Bronze extends GT_MetaTileEntity_Basi @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_HAMMER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_HAMMER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_HAMMER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_HAMMER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_HAMMER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_HAMMER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_HAMMER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_HAMMER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_HAMMER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_HAMMER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_HAMMER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_HAMMER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_HAMMER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_HAMMER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_HAMMER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_HAMMER), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_HAMMER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_HAMMER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_HAMMER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_HAMMER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_HAMMER_GLOW) + .glow() + .build() + }; } /** @@ -141,8 +180,8 @@ public class GT_MetaTileEntity_ForgeHammer_Bronze extends GT_MetaTileEntity_Basi final byte mainFacing = (byte) this.mMainFacing; if (mainFacing > 1 - && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { + && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 + && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { final double oX = aBaseMetaTileEntity.getXCoord(); final double oY = aBaseMetaTileEntity.getYCoord(); @@ -177,8 +216,7 @@ public class GT_MetaTileEntity_ForgeHammer_Bronze extends GT_MetaTileEntity_Basi mZ = .05D; } - ParticleEventBuilder particleEventBuilder = - (new ParticleEventBuilder()) + ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder()) .setMotion(mX, 0, mZ) .setPosition(x, y, z) .setWorld(getBaseMetaTileEntity().getWorld()); diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java index db31c74499..dd233aa6f2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java @@ -1,5 +1,8 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.ParticleFX; @@ -17,9 +20,6 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.common.util.ForgeDirection; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public class GT_MetaTileEntity_ForgeHammer_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_ForgeHammer_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Forge Hammer", 1, 1, true); @@ -40,7 +40,14 @@ public class GT_MetaTileEntity_ForgeHammer_Steel extends GT_MetaTileEntity_Basic @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelHammer.png", GT_Recipe.GT_Recipe_Map.sHammerRecipes.mUnlocalizedName, (byte) 6, (byte) 3); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "SteelHammer.png", + GT_Recipe.GT_Recipe_Map.sHammerRecipes.mUnlocalizedName, + (byte) 6, + (byte) 3); } @Override @@ -63,66 +70,98 @@ public class GT_MetaTileEntity_ForgeHammer_Steel extends GT_MetaTileEntity_Basic @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_HAMMER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_HAMMER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_HAMMER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_HAMMER), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_HAMMER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_HAMMER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_HAMMER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_HAMMER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_HAMMER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_HAMMER), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_HAMMER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_HAMMER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_HAMMER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_HAMMER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_HAMMER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_HAMMER), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_HAMMER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_HAMMER_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_HAMMER), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_HAMMER_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_HAMMER_GLOW) + .glow() + .build() + }; } /** @@ -141,8 +180,8 @@ public class GT_MetaTileEntity_ForgeHammer_Steel extends GT_MetaTileEntity_Basic final byte mainFacing = (byte) this.mMainFacing; if (mainFacing > 1 - && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { + && aBaseMetaTileEntity.getCoverIDAtSide(mainFacing) == 0 + && !aBaseMetaTileEntity.getOpacityAtSide(mainFacing)) { final double oX = aBaseMetaTileEntity.getXCoord(); final double oY = aBaseMetaTileEntity.getYCoord(); @@ -177,8 +216,7 @@ public class GT_MetaTileEntity_ForgeHammer_Steel extends GT_MetaTileEntity_Basic mZ = .05D; } - ParticleEventBuilder particleEventBuilder = - (new ParticleEventBuilder()) + ParticleEventBuilder particleEventBuilder = (new ParticleEventBuilder()) .setMotion(mX, 0, mZ) .setPosition(x, y, z) .setWorld(getBaseMetaTileEntity().getWorld()); diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java index 0a8ed8a6fd..cd99dda2e2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.SoundResource; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; @@ -12,8 +14,6 @@ import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_Furnace_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_Furnace_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Smelting things with compressed Steam", 1, 1, false); @@ -34,7 +34,8 @@ public class GT_MetaTileEntity_Furnace_Bronze extends GT_MetaTileEntity_BasicMac @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeFurnace.png", "smelting"); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeFurnace.png", "smelting"); } @Override @@ -53,8 +54,10 @@ public class GT_MetaTileEntity_Furnace_Bronze extends GT_MetaTileEntity_BasicMac } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null; + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null; } @Override @@ -72,66 +75,98 @@ public class GT_MetaTileEntity_Furnace_Bronze extends GT_MetaTileEntity_BasicMac @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of( - TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW).glow().build())}; + TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE), + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW) + .glow() + .build()) + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java index a4c76773a5..3bc35d8c47 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java @@ -1,5 +1,7 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.Textures.BlockIcons.*; + import gregtech.api.enums.SoundResource; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; @@ -12,8 +14,6 @@ import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import static gregtech.api.enums.Textures.BlockIcons.*; - public class GT_MetaTileEntity_Furnace_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_Furnace_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Smelting things with compressed Steam", 1, 1, true); @@ -34,7 +34,8 @@ public class GT_MetaTileEntity_Furnace_Steel extends GT_MetaTileEntity_BasicMach @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelFurnace.png", "smelting"); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelFurnace.png", "smelting"); } @Override @@ -53,8 +54,10 @@ public class GT_MetaTileEntity_Furnace_Steel extends GT_MetaTileEntity_BasicMach } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null; + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null; } @Override @@ -72,65 +75,97 @@ public class GT_MetaTileEntity_Furnace_Steel extends GT_MetaTileEntity_BasicMach @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_FURNACE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_FURNACE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_FURNACE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_FURNACE_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java index fe107957bf..f6f5bf8477 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java @@ -1,5 +1,9 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import gregtech.api.enums.ParticleFX; import gregtech.api.enums.SoundResource; import gregtech.api.gui.GT_GUIContainer_BasicMachine; @@ -17,10 +21,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_Macerator_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Macerating your Ores", 1, 1, false); @@ -36,7 +36,12 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeMacerator.png", GT_Recipe_Map.sMaceratorRecipes.mUnlocalizedName); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "BronzeMacerator.png", + GT_Recipe_Map.sMaceratorRecipes.mUnlocalizedName); } @Override @@ -52,19 +57,18 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM final byte topFacing = (byte) ForgeDirection.UP.ordinal(); if (aBaseMetaTileEntity.getFrontFacing() != topFacing - && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { + && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 + && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { new ParticleEventBuilder() - .setMotion(0.0D, 0.0D, 0.0D) - .setIdentifier(ParticleFX.SMOKE) - .setPosition( - aBaseMetaTileEntity.getXCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F, - aBaseMetaTileEntity.getYCoord() + 0.9F + XSTR_INSTANCE.nextFloat() * 0.2F, - aBaseMetaTileEntity.getZCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F - ) - .setWorld(getBaseMetaTileEntity().getWorld()) - .run(); + .setMotion(0.0D, 0.0D, 0.0D) + .setIdentifier(ParticleFX.SMOKE) + .setPosition( + aBaseMetaTileEntity.getXCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F, + aBaseMetaTileEntity.getYCoord() + 0.9F + XSTR_INSTANCE.nextFloat() * 0.2F, + aBaseMetaTileEntity.getZCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F) + .setWorld(getBaseMetaTileEntity().getWorld()) + .run(); } } } @@ -76,7 +80,8 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM @Override public int checkRecipe() { - GT_Recipe tRecipe = getRecipeList().findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], null, null, getAllInputs()); + GT_Recipe tRecipe = getRecipeList() + .findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], null, null, getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; if (!canOutput(tRecipe)) { @@ -84,7 +89,7 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM 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; if (tRecipe.getOutput(0) != null) mOutputItems[0] = tRecipe.getOutput(0); calculateOverclockedNess(tRecipe); @@ -92,8 +97,10 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM } @Override - protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack)); + protected boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + && GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack)); } @Override @@ -111,65 +118,97 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_MACERATOR), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_MACERATOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_MACERATOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_MACERATOR), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_MACERATOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_MACERATOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_MACERATOR), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_MACERATOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_MACERATOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_MACERATOR), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_MACERATOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_MACERATOR_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java index 638419034e..14acdb9b45 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java @@ -1,5 +1,9 @@ package gregtech.common.tileentities.machines.steam; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; + import gregtech.api.enums.ParticleFX; import gregtech.api.enums.SoundResource; import gregtech.api.gui.GT_GUIContainer_BasicMachine; @@ -17,10 +21,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_Macerator_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Macerating your Ores", 1, 1, true); @@ -36,7 +36,12 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelMacerator.png", GT_Recipe_Map.sMaceratorRecipes.mUnlocalizedName); + return new GT_GUIContainer_BasicMachine( + aPlayerInventory, + aBaseMetaTileEntity, + getLocalName(), + "SteelMacerator.png", + GT_Recipe_Map.sMaceratorRecipes.mUnlocalizedName); } @Override @@ -52,19 +57,18 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa final byte topFacing = (byte) ForgeDirection.UP.ordinal(); if (aBaseMetaTileEntity.getFrontFacing() != topFacing - && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { + && aBaseMetaTileEntity.getCoverIDAtSide(topFacing) == 0 + && !aBaseMetaTileEntity.getOpacityAtSide(topFacing)) { new WorldSpawnedEventBuilder.ParticleEventBuilder() - .setMotion(0.0D, 0.0D, 0.0D) - .setIdentifier(ParticleFX.SMOKE) - .setPosition( - aBaseMetaTileEntity.getXCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F, - aBaseMetaTileEntity.getYCoord() + 0.9F + XSTR_INSTANCE.nextFloat() * 0.2F, - aBaseMetaTileEntity.getZCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F - ) - .setWorld(getBaseMetaTileEntity().getWorld()) - .run(); + .setMotion(0.0D, 0.0D, 0.0D) + .setIdentifier(ParticleFX.SMOKE) + .setPosition( + aBaseMetaTileEntity.getXCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F, + aBaseMetaTileEntity.getYCoord() + 0.9F + XSTR_INSTANCE.nextFloat() * 0.2F, + aBaseMetaTileEntity.getZCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F) + .setWorld(getBaseMetaTileEntity().getWorld()) + .run(); } } } @@ -76,7 +80,8 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa @Override public int checkRecipe() { - GT_Recipe tRecipe = getRecipeList().findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], null, null, getAllInputs()); + GT_Recipe tRecipe = getRecipeList() + .findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], null, null, getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; if (!canOutput(tRecipe)) { @@ -84,7 +89,7 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa 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; if (tRecipe.getOutput(0) != null) mOutputItems[0] = tRecipe.getOutput(0); calculateOverclockedNess(tRecipe); @@ -92,8 +97,10 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa } @Override - public boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack)); + public boolean allowPutStackValidated( + IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) + && GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack)); } @Override @@ -111,60 +118,97 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingActive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_MACERATOR), - TextureFactory.builder().addIcon(OVERLAY_SIDE_STEAM_MACERATOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_SIDE_STEAM_MACERATOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{ + return new ITexture[] { super.getFrontFacingActive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], + return new ITexture[] { + super.getFrontFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_FRONT_STEAM_MACERATOR), - TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_MACERATOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_STEAM_MACERATOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], + return new ITexture[] { + super.getTopFacingActive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], + return new ITexture[] { + super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_MACERATOR), - TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_MACERATOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_TOP_STEAM_MACERATOR_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], + return new ITexture[] { + super.getBottomFacingActive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE_GLOW) + .glow() + .build() + }; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], + return new ITexture[] { + super.getBottomFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_BOTTOM_STEAM_MACERATOR), - TextureFactory.builder().addIcon(OVERLAY_BOTTOM_STEAM_MACERATOR_GLOW).glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_BOTTOM_STEAM_MACERATOR_GLOW) + .glow() + .build() + }; } } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java index ffd1fd0e4a..8c844b8071 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java @@ -1,5 +1,9 @@ package gregtech.common.tileentities.storage; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SCHEST; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SCHEST_GLOW; + import cpw.mods.fml.common.Optional; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; @@ -11,6 +15,8 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_QuantumChest; import gregtech.common.gui.GT_GUIContainer_QuantumChest; +import java.util.HashMap; +import java.util.Map; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -18,26 +24,21 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import java.util.HashMap; -import java.util.Map; - -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SCHEST; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SCHEST_GLOW; - @Optional.Interface(iface = "appeng.api.storage.IMEMonitor", modid = "appliedenergistics2", striprefs = true) -public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock implements appeng.api.storage.IMEMonitor<appeng.api.storage.data.IAEItemStack> { +public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock + implements appeng.api.storage.IMEMonitor<appeng.api.storage.data.IAEItemStack> { protected boolean mVoidOverflow = false; public boolean voidBreak; - private Map<appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack>, Object> listeners = null; + private Map<appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack>, Object> listeners = + null; public GT_MetaTileEntity_DigitalChestBase(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, new String[]{ - "This Chest stores " + GT_Utility.formatNumbers(commonSizeCompute(aTier)) + " Blocks", - "Use a screwdriver to enable", - "voiding items on overflow", - "Can keep its contents when harvested", - "Sneak when harvesting to void its contents" + super(aID, aName, aNameRegional, aTier, 3, new String[] { + "This Chest stores " + GT_Utility.formatNumbers(commonSizeCompute(aTier)) + " Blocks", + "Use a screwdriver to enable", + "voiding items on overflow", + "Can keep its contents when harvested", + "Sneak when harvesting to void its contents" }); } @@ -72,28 +73,35 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti super(aName, aTier, 3, aDescription, aTextures); } - public GT_MetaTileEntity_DigitalChestBase(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_DigitalChestBase( + String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); } @Optional.Method(modid = "appliedenergistics2") public static void registerAEIntegration() { - appeng.api.AEApi.instance().registries().externalStorage().addExternalStorageInterface(new AE2DigitalChestHandler()); + appeng.api.AEApi.instance() + .registries() + .externalStorage() + .addExternalStorageInterface(new AE2DigitalChestHandler()); } @Optional.Method(modid = "appliedenergistics2") @Override - public void addListener(appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> imeMonitorHandlerReceiver, Object o) { - if (listeners == null) - listeners = new HashMap<>(); + public void addListener( + appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> + imeMonitorHandlerReceiver, + Object o) { + if (listeners == null) listeners = new HashMap<>(); listeners.put(imeMonitorHandlerReceiver, o); } @Optional.Method(modid = "appliedenergistics2") @Override - public void removeListener(appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> imeMonitorHandlerReceiver) { - if (listeners == null) - listeners = new HashMap<>(); + public void removeListener( + appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> + imeMonitorHandlerReceiver) { + if (listeners == null) listeners = new HashMap<>(); listeners.remove(imeMonitorHandlerReceiver); } @@ -107,8 +115,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti @Override public boolean isPrioritized(appeng.api.storage.data.IAEItemStack iaeItemStack) { ItemStack s = getItemStack(); - if (s == null || iaeItemStack == null) - return false; + if (s == null || iaeItemStack == null) return false; return iaeItemStack.isSameType(s); } @@ -116,8 +123,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti @Override public boolean canAccept(appeng.api.storage.data.IAEItemStack iaeItemStack) { ItemStack s = getItemStack(); - if (s == null || iaeItemStack == null) - return true; + if (s == null || iaeItemStack == null) return true; return iaeItemStack.isSameType(s); } @@ -145,7 +151,8 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti @Override @Optional.Method(modid = "appliedenergistics2") - public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getAvailableItems(final appeng.api.storage.data.IItemList out) { + public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getAvailableItems( + final appeng.api.storage.data.IItemList out) { ItemStack storedStack = getItemStack(); if (storedStack != null) { appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(storedStack); @@ -195,12 +202,13 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti @Override @Optional.Method(modid = "appliedenergistics2") - public appeng.api.storage.data.IAEItemStack injectItems(final appeng.api.storage.data.IAEItemStack input, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) { + public appeng.api.storage.data.IAEItemStack injectItems( + final appeng.api.storage.data.IAEItemStack input, + final appeng.api.config.Actionable mode, + final appeng.api.networking.security.BaseActionSource src) { final ItemStack inputStack = input.getItemStack(); - if (inputStack == null) - return null; - if (getBaseMetaTileEntity() == null) - return input; + if (inputStack == null) return null; + if (getBaseMetaTileEntity() == null) return input; if (mode != appeng.api.config.Actionable.SIMULATE) getBaseMetaTileEntity().markDirty(); ItemStack storedStack = getItemStack(); @@ -208,8 +216,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti if (GT_Utility.areStacksEqual(storedStack, inputStack)) { if (input.getStackSize() + getItemCount() > getMaxItemCount()) { if (mVoidOverflow) { - if (mode != appeng.api.config.Actionable.SIMULATE) - setItemCount(getMaxItemCount()); + if (mode != appeng.api.config.Actionable.SIMULATE) setItemCount(getMaxItemCount()); return null; } return createOverflowStack(input.getStackSize() + getItemCount(), mode); @@ -220,12 +227,9 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti } return input; } - if (mode != appeng.api.config.Actionable.SIMULATE) - setItemStack(inputStack.copy()); - if (input.getStackSize() > getMaxItemCount()) - return createOverflowStack(input.getStackSize(), mode); - if (mode != appeng.api.config.Actionable.SIMULATE) - setItemCount((int) input.getStackSize()); + if (mode != appeng.api.config.Actionable.SIMULATE) setItemStack(inputStack.copy()); + if (input.getStackSize() > getMaxItemCount()) return createOverflowStack(input.getStackSize(), mode); + if (mode != appeng.api.config.Actionable.SIMULATE) setItemCount((int) input.getStackSize()); return null; } @@ -233,24 +237,24 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti private appeng.api.storage.data.IAEItemStack createOverflowStack(long size, appeng.api.config.Actionable mode) { final appeng.api.storage.data.IAEItemStack overflow = appeng.util.item.AEItemStack.create(getItemStack()); overflow.setStackSize(size - getMaxItemCount()); - if (mode != appeng.api.config.Actionable.SIMULATE) - setItemCount(getMaxItemCount()); + if (mode != appeng.api.config.Actionable.SIMULATE) setItemCount(getMaxItemCount()); return overflow; } @Override @Optional.Method(modid = "appliedenergistics2") - public appeng.api.storage.data.IAEItemStack extractItems(final appeng.api.storage.data.IAEItemStack request, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) { + public appeng.api.storage.data.IAEItemStack extractItems( + final appeng.api.storage.data.IAEItemStack request, + final appeng.api.config.Actionable mode, + final appeng.api.networking.security.BaseActionSource src) { if (request.isSameType(getItemStack())) { - if (getBaseMetaTileEntity() == null) - return null; + if (getBaseMetaTileEntity() == null) return null; if (mode != appeng.api.config.Actionable.SIMULATE) getBaseMetaTileEntity().markDirty(); if (request.getStackSize() >= getItemCount()) { appeng.util.item.AEItemStack result = appeng.util.item.AEItemStack.create(getItemStack()); result.setStackSize(getItemCount()); - if (mode != appeng.api.config.Actionable.SIMULATE) - setItemCount(0); + if (mode != appeng.api.config.Actionable.SIMULATE) setItemCount(0); return result; } else { if (mode != appeng.api.config.Actionable.SIMULATE) @@ -270,7 +274,10 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti @Override public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { mVoidOverflow = !mVoidOverflow; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal(mVoidOverflow ? "GT5U.machines.voidoveflow.enabled" : "GT5U.machines.voidoveflow.disabled")); + GT_Utility.sendChatToPlayer( + aPlayer, + StatCollector.translateToLocal( + mVoidOverflow ? "GT5U.machines.voidoveflow.enabled" : "GT5U.machines.voidoveflow.disabled")); } @Override @@ -288,7 +295,9 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti ItemStack stack = getItemStack(); int savedCount = count; - if ((mInventory[0] != null) && ((count < getMaxItemCount()) || mVoidOverflow) && GT_Utility.areStacksEqual(mInventory[0], stack)) { + if ((mInventory[0] != null) + && ((count < getMaxItemCount()) || mVoidOverflow) + && GT_Utility.areStacksEqual(mInventory[0], stack)) { count += mInventory[0].stackSize; if (count <= getMaxItemCount()) { mInventory[0] = null; @@ -305,7 +314,9 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti mInventory[1] = stack.copy(); mInventory[1].stackSize = Math.min(stack.getMaxStackSize(), count); count -= mInventory[1].stackSize; - } else if ((count > 0) && GT_Utility.areStacksEqual(mInventory[1], stack) && mInventory[1].getMaxStackSize() > mInventory[1].stackSize) { + } else if ((count > 0) + && GT_Utility.areStacksEqual(mInventory[1], stack) + && mInventory[1].getMaxStackSize() > mInventory[1].stackSize) { int tmp = Math.min(count, mInventory[1].getMaxStackSize() - mInventory[1].stackSize); mInventory[1].stackSize += tmp; count -= tmp; @@ -318,10 +329,8 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti mInventory[2] = null; } - if (GregTech_API.mAE2) - notifyListeners(count - savedCount, stack); - if (count != savedCount) - getBaseMetaTileEntity().markDirty(); + if (GregTech_API.mAE2) notifyListeners(count - savedCount, stack); + if (count != savedCount) getBaseMetaTileEntity().markDirty(); } } @@ -359,7 +368,9 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti @Override public int getProgresstime() { - return getItemCount() + (mInventory[0] == null ? 0 : mInventory[0].stackSize) + (mInventory[1] == null ? 0 : mInventory[1].stackSize); + return getItemCount() + + (mInventory[0] == null ? 0 : mInventory[0].stackSize) + + (mInventory[1] == null ? 0 : mInventory[1].stackSize); } @Override @@ -376,20 +387,20 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti public String[] getInfoData() { if (getItemStack() == null) { - return new String[]{ - EnumChatFormatting.BLUE + chestName() + EnumChatFormatting.RESET, - "Stored Items:", - EnumChatFormatting.GOLD + "No Items" + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + "0" + EnumChatFormatting.RESET + " " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxItemCount()) + EnumChatFormatting.RESET - }; - } - return new String[]{ + return new String[] { EnumChatFormatting.BLUE + chestName() + EnumChatFormatting.RESET, "Stored Items:", - EnumChatFormatting.GOLD + getItemStack().getDisplayName() + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(getItemCount()) + EnumChatFormatting.RESET + " " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxItemCount()) + EnumChatFormatting.RESET + EnumChatFormatting.GOLD + "No Items" + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + "0" + EnumChatFormatting.RESET + " " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(getMaxItemCount()) + EnumChatFormatting.RESET + }; + } + return new String[] { + EnumChatFormatting.BLUE + chestName() + EnumChatFormatting.RESET, + "Stored Items:", + EnumChatFormatting.GOLD + getItemStack().getDisplayName() + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(getItemCount()) + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getMaxItemCount()) + EnumChatFormatting.RESET }; } @@ -406,31 +417,25 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti listeners = new HashMap<>(); return; } - if (count == 0 || stack == null) - return; + if (count == 0 || stack == null) return; appeng.util.item.ItemList change = new appeng.util.item.ItemList(); appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(stack); s.setStackSize(count); change.add(s); listeners.forEach((l, o) -> { - if (l.isValid(o)) - l.postChange(this, change, null); - else - removeListener(l); + if (l.isValid(o)) l.postChange(this, change, null); + else removeListener(l); }); } @Optional.Method(modid = "appliedenergistics2") private boolean hasActiveMEConnection() { - if (listeners == null || listeners.isEmpty()) - return false; - for (Map.Entry<appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack>, Object> e : listeners.entrySet()) - { - if ((e.getKey() instanceof appeng.api.parts.IPart)) - { + if (listeners == null || listeners.isEmpty()) return false; + for (Map.Entry<appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack>, Object> e : + listeners.entrySet()) { + if ((e.getKey() instanceof appeng.api.parts.IPart)) { appeng.api.networking.IGridNode n = ((appeng.api.parts.IPart) e.getKey()).getGridNode(); - if (n != null && n.isActive()) - return true; + if (n != null && n.isActive()) return true; } } // if there are no active storage buses - clear the listeners @@ -441,42 +446,43 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setInteger("mItemCount", getItemCount()); - if (getItemStack() != null) - aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); + if (getItemStack() != null) aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); aNBT.setBoolean("mVoidOverflow", mVoidOverflow); } @Override public void loadNBTData(NBTTagCompound aNBT) { - if (aNBT.hasKey("mItemCount")) - setItemCount(aNBT.getInteger("mItemCount")); + if (aNBT.hasKey("mItemCount")) setItemCount(aNBT.getInteger("mItemCount")); if (aNBT.hasKey("mItemStack")) setItemStack(ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack"))); mVoidOverflow = aNBT.getBoolean("mVoidOverflow"); - } @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (GregTech_API.mAE2 && GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection()) - return false; + if (GregTech_API.mAE2 && GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection()) return false; return aIndex == 1; } @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (GregTech_API.mAE2 && GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection()) - return false; + if (GregTech_API.mAE2 && GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection()) return false; return aIndex == 0 && (mInventory[0] == null || GT_Utility.areStacksEqual(mInventory[0], aStack)); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide != aFacing) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]}; - return new ITexture[]{ - MACHINE_CASINGS[mTier][aColorIndex + 1], - TextureFactory.of(OVERLAY_SCHEST), - TextureFactory.builder().addIcon(OVERLAY_SCHEST_GLOW).glow().build() + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + if (aSide != aFacing) return new ITexture[] {MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[] { + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_SCHEST), + TextureFactory.builder().addIcon(OVERLAY_SCHEST_GLOW).glow().build() }; } } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java index 2567a80252..6b2a9caf4b 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalTankBase.java @@ -1,5 +1,9 @@ package gregtech.common.tileentities.storage; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK_GLOW; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; @@ -13,17 +17,12 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK_GLOW; - public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntity_BasicTank { protected boolean mVoidOverflow = false; private boolean voidBreak; - public GT_MetaTileEntity_DigitalTankBase(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, new String[]{ + super(aID, aName, aNameRegional, aTier, 3, new String[] { "Stores " + GT_Utility.formatNumbers(commonSizeCompute(aTier)) + "L of fluid", "Use a screwdriver to enable", "voiding fluid on overflow", @@ -59,7 +58,6 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit } } - public GT_MetaTileEntity_DigitalTankBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); } @@ -84,7 +82,6 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit super.setItemNBT(aNBT); } - @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); @@ -97,7 +94,6 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit mVoidOverflow = aNBT.getBoolean("mVoidOverflow"); } - @Override public boolean isSimpleMachine() { return true; @@ -134,9 +130,15 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]}; - return new ITexture[]{ + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[] {MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[] { MACHINE_CASINGS[mTier][aColorIndex + 1], TextureFactory.of(OVERLAY_QTANK), TextureFactory.builder().addIcon(OVERLAY_QTANK_GLOW).glow().build() @@ -158,7 +160,10 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit @Override public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { mVoidOverflow = !mVoidOverflow; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal(mVoidOverflow ? "GT5U.machines.voidoveflow.enabled" : "GT5U.machines.voidoveflow.disabled")); + GT_Utility.sendChatToPlayer( + aPlayer, + StatCollector.translateToLocal( + mVoidOverflow ? "GT5U.machines.voidoveflow.enabled" : "GT5U.machines.voidoveflow.disabled")); } @Override @@ -185,8 +190,7 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit if (isFluidChangingAllowed() && getFillableStack() != null && getFillableStack().amount <= 0) setFillableStack(null); - if (mOpenerCount > 0) - updateFluidDisplayItem(); + if (mOpenerCount > 0) updateFluidDisplayItem(); if (doesEmptyContainers()) { FluidStack tFluid = GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true); @@ -196,7 +200,10 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit if ((tFluid.amount <= getRealCapacity()) || mVoidOverflow) { tFluid = tFluid.copy(); tFluid.amount = Math.min(tFluid.amount, getRealCapacity()); - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), 1)) { + if (aBaseMetaTileEntity.addStackToSlot( + getOutputSlot(), + GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), + 1)) { setFillableStack(tFluid); this.onEmptyingContainerWhenEmpty(); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); @@ -205,9 +212,14 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit } } else { if (tFluid.isFluidEqual(getFillableStack())) { - if ((((long) tFluid.amount + getFillableStack().amount) <= (long) getRealCapacity()) || mVoidOverflow) { - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), 1)) { - getFillableStack().amount += Math.min(tFluid.amount, getRealCapacity() - getFillableStack().amount); + if ((((long) tFluid.amount + getFillableStack().amount) <= (long) getRealCapacity()) + || mVoidOverflow) { + if (aBaseMetaTileEntity.addStackToSlot( + getOutputSlot(), + GT_Utility.getContainerForFilledItem(mInventory[getInputSlot()], true), + 1)) { + getFillableStack().amount += + Math.min(tFluid.amount, getRealCapacity() - getFillableStack().amount); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); } } @@ -217,7 +229,8 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit } 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); @@ -230,8 +243,11 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit @Override public int fill(FluidStack aFluid, boolean doFill) { - if (aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) - return 0; + if (aFluid == null + || aFluid.getFluid().getID() <= 0 + || aFluid.amount <= 0 + || !canTankBeFilled() + || !isFluidInputAllowed(aFluid)) return 0; if (getFillableStack() != null && !getFillableStack().isFluidEqual(aFluid)) { return 0; } @@ -276,7 +292,7 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit return mVoidOverflow ? Integer.MAX_VALUE : getRealCapacity(); } - public int getRealCapacity(){ + public int getRealCapacity() { return commonSizeCompute(mTier); } @@ -292,6 +308,6 @@ public abstract class GT_MetaTileEntity_DigitalTankBase extends GT_MetaTileEntit @Override public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - return new FluidTankInfo[]{getInfo()}; + return new FluidTankInfo[] {getInfo()}; } } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java index ce8380f419..b4d5345391 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java @@ -1,5 +1,10 @@ package gregtech.common.tileentities.storage; +import static gregtech.api.enums.Textures.BlockIcons.LOCKERS; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_IN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_LOCKER; + import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -12,11 +17,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import static gregtech.api.enums.Textures.BlockIcons.LOCKERS; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_IN; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_LOCKER; - public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlock { public byte mType = 0; @@ -55,9 +55,19 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{this.mTextures[2][(aColorIndex + 1)][0], this.mTextures[2][(aColorIndex + 1)][1], LOCKERS[Math.abs(this.mType % LOCKERS.length)]}; + return new ITexture[] { + this.mTextures[2][(aColorIndex + 1)][0], + this.mTextures[2][(aColorIndex + 1)][1], + LOCKERS[Math.abs(this.mType % LOCKERS.length)] + }; } return this.mTextures[0][(aColorIndex + 1)]; } @@ -172,7 +182,8 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { + public boolean onRightclick( + IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { if ((aBaseMetaTileEntity.isServerSide()) && (aSide == aBaseMetaTileEntity.getFrontFacing())) { for (int i = 0; i < 4; i++) { ItemStack tSwapStack = this.mInventory[i]; diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java index f991fea66e..384b55cc4c 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java @@ -47,8 +47,7 @@ public class GT_MetaTileEntity_QuantumChest extends GT_MetaTileEntity_DigitalChe mInvData.appendTag(tNBT); } } - if (mItemStack != null) - aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); + if (mItemStack != null) aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); aNBT.setTag("Inventory", mInvData); aNBT.setInteger("mItemCount", getItemCount()); aNBT.setBoolean("mVoidOverflow", mVoidOverflow); @@ -58,7 +57,7 @@ public class GT_MetaTileEntity_QuantumChest extends GT_MetaTileEntity_DigitalChe @Override protected String chestName() { - return "Quantum Chest"; + return "Quantum Chest"; } @Override @@ -73,7 +72,7 @@ public class GT_MetaTileEntity_QuantumChest extends GT_MetaTileEntity_DigitalChe @Override protected ItemStack getItemStack() { - return mItemStack; + return mItemStack; } @Override diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java index da283a19d8..886dd676e7 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java @@ -28,21 +28,22 @@ public class GT_MetaTileEntity_QuantumTank extends GT_MetaTileEntity_DigitalTank public String[] getInfoData() { if (mFluid == null) { - return new String[]{ - EnumChatFormatting.BLUE + "Quantum Tank" + EnumChatFormatting.RESET, - "Stored Fluid:", - EnumChatFormatting.GOLD + "No Fluid" + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + Integer.toString(0) + " L" + EnumChatFormatting.RESET + " " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET - }; - } - return new String[]{ + return new String[] { EnumChatFormatting.BLUE + "Quantum Tank" + EnumChatFormatting.RESET, "Stored Fluid:", - EnumChatFormatting.GOLD + mFluid.getLocalizedName() + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET + EnumChatFormatting.GOLD + "No Fluid" + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + Integer.toString(0) + " L" + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + + EnumChatFormatting.RESET + }; + } + return new String[] { + EnumChatFormatting.BLUE + "Quantum Tank" + EnumChatFormatting.RESET, + "Stored Fluid:", + EnumChatFormatting.GOLD + mFluid.getLocalizedName() + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + + EnumChatFormatting.RESET }; } - } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java index 92f9aec998..f2be7312ec 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java @@ -42,8 +42,7 @@ public class GT_MetaTileEntity_SuperChest extends GT_MetaTileEntity_DigitalChest mInvData.appendTag(tNBT); } } - if (mItemStack != null) - aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); + if (mItemStack != null) aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); aNBT.setTag("Inventory", mInvData); aNBT.setInteger("mItemCount", getItemCount()); aNBT.setBoolean("mVoidOverflow", mVoidOverflow); diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java index dbe54e9005..3b7fb8e849 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java @@ -28,21 +28,21 @@ public class GT_MetaTileEntity_SuperTank extends GT_MetaTileEntity_DigitalTankBa public String[] getInfoData() { if (mFluid == null) { - return new String[]{ - EnumChatFormatting.BLUE + "Super Tank" + EnumChatFormatting.RESET, - "Stored Fluid:", - EnumChatFormatting.GOLD + "No Fluid" + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + "0 L" + EnumChatFormatting.RESET + " " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET - }; - } - return new String[]{ + return new String[] { EnumChatFormatting.BLUE + "Super Tank" + EnumChatFormatting.RESET, "Stored Fluid:", - EnumChatFormatting.GOLD + mFluid.getLocalizedName() + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " + - EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET + EnumChatFormatting.GOLD + "No Fluid" + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + "0 L" + EnumChatFormatting.RESET + " " + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(getCapacity()) + " L" + EnumChatFormatting.RESET + }; + } + return new String[] { + EnumChatFormatting.BLUE + "Super Tank" + EnumChatFormatting.RESET, + "Stored Fluid:", + EnumChatFormatting.GOLD + mFluid.getLocalizedName() + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCapacity()) + " L" + + EnumChatFormatting.RESET }; } - } |