From 0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Mon, 30 Jan 2023 10:56:42 -0800 Subject: [ci skip] spotlessApply with the new settings --- .../GT_MetaTileEntity_AdvSeismicProspector.java | 174 +++----- .../basic/GT_MetaTileEntity_Boxinator.java | 115 ++--- .../machines/basic/GT_MetaTileEntity_Charger.java | 29 +- .../basic/GT_MetaTileEntity_CuringOven.java | 94 ++-- .../basic/GT_MetaTileEntity_Disassembler.java | 197 ++++----- .../basic/GT_MetaTileEntity_IndustrialApiary.java | 474 +++++++++------------ .../basic/GT_MetaTileEntity_Massfabricator.java | 88 ++-- ..._MetaTileEntity_MicrowaveEnergyTransmitter.java | 235 +++++----- .../machines/basic/GT_MetaTileEntity_Miner.java | 178 ++++---- .../basic/GT_MetaTileEntity_MonsterRepellent.java | 85 ++-- .../basic/GT_MetaTileEntity_PotionBrewer.java | 83 ++-- .../machines/basic/GT_MetaTileEntity_Printer.java | 46 +- .../machines/basic/GT_MetaTileEntity_Pump.java | 293 +++++++------ .../basic/GT_MetaTileEntity_Replicator.java | 82 ++-- .../basic/GT_MetaTileEntity_RockBreaker.java | 77 ++-- .../machines/basic/GT_MetaTileEntity_Scanner.java | 166 +++----- .../basic/GT_MetaTileEntity_SeismicProspector.java | 213 ++++----- .../basic/GT_MetaTileEntity_Teleporter.java | 387 ++++++++--------- 18 files changed, 1319 insertions(+), 1697 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/basic') 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 ee2ddcdfed..34589d2c1c 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 @@ -3,6 +3,21 @@ package gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.Textures.BlockIcons.*; import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; +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; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -17,29 +32,17 @@ 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; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_BasicMachine { + boolean ready = false; int radius; int step; int cX; int cZ; - public GT_MetaTileEntity_AdvSeismicProspector( - int aID, String aName, String aNameRegional, int aTier, int aRadius, int aStep) { + public GT_MetaTileEntity_AdvSeismicProspector(int aID, String aName, String aNameRegional, int aTier, int aRadius, + int aStep) { super( aID, aName, @@ -53,76 +56,43 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba "", // NEI name 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())); 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; @@ -146,42 +116,40 @@ 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 + } else if (ready && mMaxProgresstime == 0 && aStack != null && aStack.stackSize == 1 && aStack.getItem() == ItemList.Tool_DataStick.getItem()) { - this.ready = false; - - // prospecting ores - HashMap tOres = new HashMap<>(36); - - prospectOres(tOres); - - // prospecting oils - ArrayList 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); - } + this.ready = false; + + // prospecting ores + HashMap tOres = new HashMap<>(36); + + prospectOres(tOres); + + // prospecting oils + ArrayList 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); + } } return true; @@ -205,10 +173,9 @@ 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; @@ -220,12 +187,10 @@ 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 aOres) { @@ -264,10 +229,11 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba if (tBlock instanceof GT_Block_Ores_Abstract) { 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]; + 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]; if ((tMaterial != null) && (tMaterial != Materials._NULL)) return tMaterial.mDefaultLocalName; } 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 e718fe0a2d..f94b8404fa 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 @@ -2,6 +2,8 @@ package gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.Textures.BlockIcons.*; +import net.minecraft.item.ItemStack; + import gregtech.api.enums.ItemList; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -11,9 +13,9 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine { + ItemStack aInputCache; ItemStack aOutputCache; int aTypeCache = 0; @@ -32,73 +34,49 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine "", 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); + this.mName, + this.mTier, + this.mDescriptionArray, + this.mTextures, + this.mGUIName, + this.mNEIName); } @Override @@ -107,11 +85,11 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine } private boolean hasValidCache(ItemStack mItem, int mType, boolean mClearOnFailure) { - if (aInputCache != null - && aOutputCache != null + 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; @@ -135,8 +113,7 @@ 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)) + 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); @@ -156,8 +133,7 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine } if ((ItemList.Schematic_2by2.isStackEqual(tSlot1)) && (getInputAt(0).stackSize >= 4)) { boolean tIsCached = hasValidCache(tSlot0, 2, true); - this.mOutputItems[0] = tIsCached - ? aOutputCache.copy() + this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(tSlot0, tSlot0, null, tSlot0, tSlot0); if (this.mOutputItems[0] != null) { if (canOutput(this.mOutputItems[0])) { @@ -174,10 +150,17 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine } if ((ItemList.Schematic_3by3.isStackEqual(tSlot1)) && (getInputAt(0).stackSize >= 9)) { boolean tIsCached = hasValidCache(tSlot0, 3, true); - this.mOutputItems[0] = tIsCached - ? aOutputCache.copy() + this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput( - tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0); + tSlot0, + tSlot0, + tSlot0, + tSlot0, + tSlot0, + tSlot0, + tSlot0, + tSlot0, + tSlot0); if (this.mOutputItems[0] != null) { if (canOutput(this.mOutputItems[0])) { getInputAt(0).stackSize -= 9; @@ -196,24 +179,22 @@ 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)) + 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) { + 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) @@ -222,10 +203,8 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine && 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 f6223a4a0d..28caaef181 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 @@ -13,18 +13,18 @@ import gregtech.api.util.GT_Utility; 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); } @@ -65,18 +65,17 @@ public class GT_MetaTileEntity_Charger extends GT_MetaTileEntity_BasicBatteryBuf if (mMetaTileEntity.dechargerSlotCount() > 0 && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) { for (int i = mMetaTileEntity.dechargerSlotStartIndex(), - k = mMetaTileEntity.dechargerSlotCount() + i; - i < k; - i++) { + 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())), + GT_Utility.safeInt( + Math.min( + V[mTier] * 15, + mBaseMetaTileEntity.getEUCapacity() + - mBaseMetaTileEntity.getStoredEU())), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), true, false, @@ -88,9 +87,7 @@ public class GT_MetaTileEntity_Charger extends GT_MetaTileEntity_BasicBatteryBuf } if (mMetaTileEntity.rechargerSlotCount() > 0 && mBaseMetaTileEntity.getStoredEU() > 0) { for (int i = mMetaTileEntity.rechargerSlotStartIndex(), - k = mMetaTileEntity.rechargerSlotCount() + i; - i < k; - i++) { + k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { if (mBaseMetaTileEntity.getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) { mBaseMetaTileEntity.decreaseStoredEU( GT_ModHandler.chargeElectricItem( 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 3dc9fd7b63..2cab223249 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,7 +1,12 @@ package gregtech.common.tileentities.machines.basic; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; + import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -11,9 +16,6 @@ import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.render.TextureFactory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine implements IAddUIWidgets { @@ -29,43 +31,43 @@ public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine 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_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_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_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); + this.mName, + this.mTier, + this.mDescriptionArray, + this.mTextures, + this.mGUIName, + this.mNEIName); } @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)) && ItemList.Cell_Empty.isStackEqual(aStack); } @@ -78,36 +80,34 @@ public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine @Override 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); - NBTTagCompound aNBT = tStack.getTagCompound(); - if (aNBT != null) { - 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; + for (ItemStack tStack : mInventory) 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(); + 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; + } } } - } - tHeat++; - if (aNBT != null) { - aNBT.setInteger("Heat", tHeat); - aNBT.setLong("HeatTime", tWorldTime); - } - if (tHeat > GT_MetaGenerated_Tool.getPrimaryMaterial(tStack).mMeltingPoint) { - mInventory[0] = null; + tHeat++; + 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 ff46aada64..bc6f50fde6 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 @@ -3,7 +3,19 @@ package gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.GT_Values.MOD_ID_RC; import static gregtech.api.enums.Textures.BlockIcons.*; +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 net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + import com.google.common.collect.ArrayListMultimap; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; @@ -25,15 +37,6 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.extensions.ArrayExt; import ic2.api.item.IC2Items; -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 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,9 +48,8 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi aTier, 1, new String[] { - "Disassembles Machines up to " + GT_Values.TIER_COLORS[aTier] + GT_Values.VOLTAGE_NAMES[aTier], - "Can also disassemble most assembler recipes!" - }, + "Disassembles Machines up to " + GT_Values.TIER_COLORS[aTier] + GT_Values.VOLTAGE_NAMES[aTier], + "Can also disassemble most assembler recipes!" }, 1, 9, "Disassembler.png", @@ -56,101 +58,65 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi // 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); + this.mName, + this.mTier, + this.mDescriptionArray, + this.mTextures, + this.mGUIName, + this.mNEIName); } - private static final ItemStack[][] alwaysReplace = { - { + 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) - } - }; + new ItemStack(Blocks.trapped_chest, 1, OreDictionary.WILDCARD_VALUE) }, + { + // ItemStack to replace + new ItemStack(Blocks.chest) } }; - private static final Object[][] OreDictionaryOverride = { - { + 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) - } - }; + "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 getOutputHardOverrides() { return outputHardOverrides; @@ -215,10 +181,10 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi if (GT_Utility.isStackInvalid(is)) return DID_NOT_FIND_RECIPE; - if (is.getItem() instanceof GT_MetaGenerated_Tool - || isCircuit(is) + 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; @@ -270,8 +236,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } - return setOutputsAndTime(recipe.inputs, recipe.stackSize) - ? FOUND_AND_SUCCESSFULLY_USED_RECIPE + return setOutputsAndTime(recipe.inputs, recipe.stackSize) ? FOUND_AND_SUCCESSFULLY_USED_RECIPE : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } @@ -283,8 +248,8 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } private int checkRecipeMap() { - GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe( - this.getBaseMetaTileEntity(), true, this.maxEUInput(), null, this.getAllInputs()); + 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) { @@ -323,8 +288,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi ItemStack[] output = new ItemStack[inputs.length]; List recipesColl = null; - if (recipes.size() > 1) - recipesColl = recipes.stream().skip(1).map(x -> x.recipe).collect(Collectors.toList()); + if (recipes.size() > 1) recipesColl = recipes.stream().skip(1).map(x -> x.recipe).collect(Collectors.toList()); handleRecipeTransformation(inputs, output, recipesColl); @@ -335,8 +299,8 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi EUt); } - private static void handleRecipeTransformation( - ItemStack[] inputs, ItemStack[] output, List recipesColl) { + private static void handleRecipeTransformation(ItemStack[] inputs, ItemStack[] output, + List recipesColl) { for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++) { Set inputsStacks = null; if (recipesColl != null) @@ -349,15 +313,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 inputsStacks) { + public static void handleRecipeTransformation(ItemStack[] inputs, ItemStack[] output, + Set 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 inputsStacks, int i) { + private static void handleRecipeTransformationInternal(ItemStack[] inputs, ItemStack[] output, + Set 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) { @@ -405,9 +369,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } private static ItemStack handleWildcard(ItemStack stack) { - if (stack != null - && stack.getItemDamage() == OreDictionary.WILDCARD_VALUE - && !stack.getItem().isDamageable()) { + if (stack != null && stack.getItemDamage() == OreDictionary.WILDCARD_VALUE && !stack.getItem().isDamageable()) { stack.setItemDamage(0); } return stack; @@ -420,8 +382,8 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi return stack; } - private static void handleReplacement( - Set inputsStacks, ItemData data, ItemStack[] output, ItemStack input, int i) { + private static void handleReplacement(Set inputsStacks, ItemData data, ItemStack[] output, + ItemStack input, int i) { AtomicReference toRpl = new AtomicReference<>(); Materials first = data.mMaterial.mMaterial; if (inputsStacks != null) { @@ -440,17 +402,12 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } } - private static void handleInputStacks( - Set inputsStacks, - AtomicReference toRpl, - ItemData data, - Materials first, - int i) { + private static void handleInputStacks(Set inputsStacks, AtomicReference 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 + if (dataAgainst == null || dataAgainst.mMaterial == null || dataAgainst.mMaterial.mMaterial == null || dataAgainst.mPrefix == null || dataAgainst.mPrefix != data.mPrefix) { @@ -473,8 +430,8 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi toRpl.set(Materials.Rubber); } - private static void handleDifferentMaterialsOnRecipes( - Materials first, Materials second, AtomicReference toRpl) { + private static void handleDifferentMaterialsOnRecipes(Materials first, Materials second, + AtomicReference 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); @@ -488,7 +445,8 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi 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); + || 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); } @@ -523,6 +481,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } static class DissassembleReference { + final int stackSize; ItemStack[] inputs; final GT_Recipe recipe; @@ -560,9 +519,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi 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()); + })).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; @@ -575,21 +532,15 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } private static double getCheaperInputs(GT_MetaTileEntity_Disassembler.DissassembleReference x) { - double fluidInputValueRaw = Arrays.stream(x.recipe.mFluidInputs) - .flatMapToInt(f -> IntStream.of(f.amount)) + 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() + 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)) + 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() + double outputValue = Arrays.stream(x.recipe.mOutputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() + (fluidOutputValueRaw / 144D); return outputValue / inputValue; } @@ -599,8 +550,8 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } @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.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 516d2dda66..a75876b82d 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 @@ -8,6 +8,27 @@ import static gregtech.api.metatileentity.BaseTileEntity.STALLED_STUTTERING_TOOL import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.*; +import java.util.stream.Collectors; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + import com.google.common.collect.ImmutableSet; import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; @@ -27,6 +48,7 @@ import com.gtnewhorizons.modularui.common.widget.SlotGroup; import com.gtnewhorizons.modularui.common.widget.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; import com.mojang.authlib.GameProfile; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import forestry.api.apiculture.*; @@ -52,25 +74,6 @@ import gregtech.api.util.GT_ApiaryModifier; import gregtech.api.util.GT_ApiaryUpgrade; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Client; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.*; -import java.util.stream.Collectors; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicMachine implements IBeeHousing, IBeeHousingInventory, IErrorLogic, IBeeModifier, IBeeListener, IAddUIWidgets { @@ -97,80 +100,56 @@ public class GT_MetaTileEntity_IndustrialApiary extends GT_MetaTileEntity_BasicM aNameRegional, aTier, 4, - new String[] {"BEES GOES BRRRR", EnumChatFormatting.GRAY + AuthorKuba}, + new String[] { "BEES GOES BRRRR", EnumChatFormatting.GRAY + AuthorKuba }, 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()