From baa9caf06bd5793ccbddd8e8335668e3edd54900 Mon Sep 17 00:00:00 2001 From: Johannes Gäßler Date: Wed, 26 Apr 2017 23:57:10 +0200 Subject: Eliminated rounding errors that caused fuel to burn too shortly The Large Boiler now saves excess fuel between items, greatly improves performance of items like sticks and planks. The Large boiler now stores excess projected EU that is lost when throttling with an integrated circuit --- src/main/java/gregtech/api/util/GT_Recipe.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/main/java/gregtech/api/util/GT_Recipe.java') diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 2bc8985c3f..3f1022167f 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -1406,17 +1406,11 @@ public class GT_Recipe implements Comparable { private GT_Recipe addRecipe(GT_Recipe recipe, double baseBurnTime){ recipe = new GT_Recipe(recipe); - //Some recipes will have a burn time like 15.9999999 and % always rounds down - double floatErrorCorrection = 0.0001; - double bronzeBurnTime = baseBurnTime * 2 + floatErrorCorrection; - bronzeBurnTime -= bronzeBurnTime % 0.05; - double steelBurnTime = baseBurnTime * 1.5 + floatErrorCorrection; - steelBurnTime -= steelBurnTime % 0.05; - double titaniumBurnTime = baseBurnTime * 1.3 + floatErrorCorrection; - titaniumBurnTime -= titaniumBurnTime % 0.05; - double tungstensteelBurnTime = baseBurnTime * 1.2 + floatErrorCorrection; - tungstensteelBurnTime -= tungstensteelBurnTime % 0.05; + double bronzeBurnTime = baseBurnTime * 2; + double steelBurnTime = baseBurnTime * 1.5; + double titaniumBurnTime = baseBurnTime * 1.3; + double tungstensteelBurnTime = baseBurnTime * 1.2; recipe.setNeiDesc("Burn time in seconds:", String.format("Bronze Boiler: %.2f", bronzeBurnTime), -- cgit From eb4568864850c043e78958bdbeefb17de3899bc7 Mon Sep 17 00:00:00 2001 From: Johannes Gäßler Date: Thu, 27 Apr 2017 00:28:07 +0200 Subject: Fixed a bug where excess fuel didn't consider the distortion from runtimeBoost. Adjusted the decimal points of the Large Boiler fuel tab to better represent the actual burn times. --- src/main/java/gregtech/api/util/GT_Recipe.java | 8 ++++---- .../machines/multi/GT_MetaTileEntity_LargeBoiler.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/java/gregtech/api/util/GT_Recipe.java') diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 3f1022167f..aed39defb2 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -1413,10 +1413,10 @@ public class GT_Recipe implements Comparable { double tungstensteelBurnTime = baseBurnTime * 1.2; recipe.setNeiDesc("Burn time in seconds:", - String.format("Bronze Boiler: %.2f", bronzeBurnTime), - String.format("Steel Boiler: %.2f", steelBurnTime), - String.format("Titanium Boiler: %.2f", titaniumBurnTime), - String.format("Tungstensteel Boiler: %.2f", tungstensteelBurnTime)); + String.format("Bronze Boiler: %.4f", bronzeBurnTime), + String.format("Steel Boiler: %.4f", steelBurnTime), + String.format("Titanium Boiler: %.4f", titaniumBurnTime), + String.format("Tungstensteel Boiler: %.4f", tungstensteelBurnTime)); return super.addRecipe(recipe); } 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 b3c0e8ce31..d720c688d8 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 @@ -134,11 +134,11 @@ public abstract class GT_MetaTileEntity_LargeBoiler ArrayList tInputList = getStoredInputs(); if (!tInputList.isEmpty()) { for (ItemStack tInput : tInputList) { - if ((GT_Utility.getFluidForFilledItem(tInput, true) == null) && ((this.mMaxProgresstime = runtimeBoost(GT_ModHandler.getFuelValue(tInput) / 80)) > 0)) { + 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(this.mMaxProgresstime); + this.mMaxProgresstime = adjustBurnTimeForConfig(runtimeBoost(this.mMaxProgresstime)); this.mEUt = adjustEUtForConfig(getEUt()); this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease()); this.mOutputItems = new ItemStack[]{GT_Utility.getContainerItem(tInput, true)}; -- cgit From cff6b44a84db895c8ef0555baf2c1e8d09b370e5 Mon Sep 17 00:00:00 2001 From: Techlone Date: Thu, 27 Apr 2017 16:32:27 +0500 Subject: Formatting clean up, nothing else --- .../GT_MetaTileEntity_BasicGenerator.java | 18 +- .../GT_MetaTileEntity_BasicMachine_GT_Recipe.java | 31 +- .../GT_MetaTileEntity_Hatch_Maintenance.java | 129 ++++---- .../GT_MetaTileEntity_Hatch_Muffler.java | 24 +- .../GT_MetaTileEntity_MultiBlockBase.java | 26 +- .../GT_MetaTileEntity_TieredMachineBlock.java | 4 +- src/main/java/gregtech/api/util/GT_Recipe.java | 137 ++++---- .../boilers/GT_MetaTileEntity_Boiler_Bronze.java | 11 +- .../boilers/GT_MetaTileEntity_Boiler_Lava.java | 10 +- .../boilers/GT_MetaTileEntity_Boiler_Solar.java | 19 +- .../boilers/GT_MetaTileEntity_Boiler_Steel.java | 10 +- .../GT_MetaTileEntity_DieselGenerator.java | 21 +- .../generators/GT_MetaTileEntity_GasTurbine.java | 20 +- .../generators/GT_MetaTileEntity_SteamTurbine.java | 40 +-- .../multi/GT_MetaTileEntity_Cleanroom.java | 366 ++++++++++----------- .../multi/GT_MetaTileEntity_LargeBoiler.java | 86 ++--- .../storage/GT_MetaTileEntity_Locker.java | 8 +- 17 files changed, 486 insertions(+), 474 deletions(-) (limited to 'src/main/java/gregtech/api/util/GT_Recipe.java') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java index b540bdded5..76b2e9aaf5 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java @@ -29,7 +29,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity public GT_MetaTileEntity_BasicGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); } - + public GT_MetaTileEntity_BasicGenerator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); } @@ -59,9 +59,9 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity @Override public String[] getDescription() { - String[] desc = new String[mDescriptionArray.length + 1]; - System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); - desc[mDescriptionArray.length] = "Fuel Efficiency: " + getEfficiency() + "%"; + String[] desc = new String[mDescriptionArray.length + 1]; + System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); + desc[mDescriptionArray.length] = "Fuel Efficiency: " + getEfficiency() + "%"; return desc; } @@ -203,8 +203,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity if (tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) { long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); if (tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), - 10 * getPollution()); + GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), + 10 * getPollution()); mFluid.amount -= tFluidAmountToUse * tConsumed; } } @@ -216,8 +216,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) { aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), - 10 * getPollution()); + GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), + 10 * getPollution()); } } } @@ -226,7 +226,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity if (aBaseMetaTileEntity.isServerSide()) aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); } - + public abstract int getPollution(); public abstract GT_Recipe_Map getRecipes(); diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index bb1ef1332f..06a115d3d4 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -35,6 +35,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ private final String mSound; private final boolean mSharedTank, mRequiresFluidForFiltering; private final byte mGUIParameterA, mGUIParameterB; + public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe) { super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName, new ITexture[]{new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM"))}); mSharedTank = aSharedTank; @@ -74,8 +75,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ case 6: case 7: case 8: - aRecipe[i] = Ic2Items.reinforcedGlass; - break; + aRecipe[i] = Ic2Items.reinforcedGlass; + break; default: aRecipe[i] = new ItemStack(Blocks.glass, 1, W); break; @@ -634,17 +635,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), mGUIName, GT_Utility.isStringValid(mNEIName) ? mNEIName : getRecipeList() != null ? getRecipeList().mUnlocalizedName : "", mGUIParameterA, mGUIParameterB); } - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) return false; - if (mInventory[aIndex] != null) return true; - switch (mInputSlotCount) { - case 0: return false; - case 1: return getFillableStack() == null ? !mRequiresFluidForFiltering && getRecipeList().containsInput(aStack) : null!=getRecipeList().findRecipe(getBaseMetaTileEntity(), mLastRecipe, true, V[mTier], new FluidStack[] {getFillableStack()}, getSpecialSlot(), new ItemStack[] {aStack}); - case 2: return (!mRequiresFluidForFiltering || getFillableStack() != null) && (((getInputAt(0)!=null&&getInputAt(1)!=null) || (getInputAt(0)==null&&getInputAt(1)==null?getRecipeList().containsInput(aStack):(getRecipeList().containsInput(aStack)&&null!=getRecipeList().findRecipe(getBaseMetaTileEntity(), mLastRecipe, true, V[mTier], new FluidStack[] {getFillableStack()}, getSpecialSlot(), aIndex == getInputSlot() ? new ItemStack[] {aStack, getInputAt(1)} : new ItemStack[] {getInputAt(0), aStack}))))); - default: return getRecipeList().containsInput(aStack); - } - } + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) return false; + if (mInventory[aIndex] != null) return true; + switch (mInputSlotCount) { + case 0: + return false; + case 1: + return getFillableStack() == null ? !mRequiresFluidForFiltering && getRecipeList().containsInput(aStack) : null != getRecipeList().findRecipe(getBaseMetaTileEntity(), mLastRecipe, true, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), new ItemStack[]{aStack}); + case 2: + return (!mRequiresFluidForFiltering || getFillableStack() != null) && (((getInputAt(0) != null && getInputAt(1) != null) || (getInputAt(0) == null && getInputAt(1) == null ? getRecipeList().containsInput(aStack) : (getRecipeList().containsInput(aStack) && null != getRecipeList().findRecipe(getBaseMetaTileEntity(), mLastRecipe, true, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), aIndex == getInputSlot() ? new ItemStack[]{aStack, getInputAt(1)} : new ItemStack[]{getInputAt(0), aStack}))))); + default: + return getRecipeList().containsInput(aStack); + } + } @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java index 339c3ae8db..3bcd29a6c9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java @@ -1,8 +1,5 @@ package gregtech.api.metatileentity.implementations; -import java.util.ArrayList; -import java.util.List; - import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; @@ -28,6 +25,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import scala.actors.threadpool.Arrays; +import java.util.List; + public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch { public boolean mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mAuto; @@ -35,7 +34,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch super(aID, aName, aNameRegional, aTier, 1, "For maintaining Multiblocks"); mAuto = false; } - + public GT_MetaTileEntity_Hatch_Maintenance(int aID, String aName, String aNameRegional, int aTier, boolean aAuto) { super(aID, aName, aNameRegional, aTier, 4, "For automatically maintaining Multiblocks"); mAuto = aAuto; @@ -53,19 +52,19 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public String[] getDescription() { - if (mAuto) { - String[] desc = new String[mDescriptionArray.length + 3]; - System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); - desc[mDescriptionArray.length] = "4 Ducttape, 2 Lubricant Cells"; - desc[mDescriptionArray.length + 1] = "4 Steel Screws, 2 Adv Circuits"; - desc[mDescriptionArray.length + 2] = "For each autorepair"; - return desc; - } else { - String[] desc = new String[mDescriptionArray.length + 1]; - System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); - desc[mDescriptionArray.length] = "Cannot be shared between Multiblocks!"; - return desc; - } + if (mAuto) { + String[] desc = new String[mDescriptionArray.length + 3]; + System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); + desc[mDescriptionArray.length] = "4 Ducttape, 2 Lubricant Cells"; + desc[mDescriptionArray.length + 1] = "4 Steel Screws, 2 Adv Circuits"; + desc[mDescriptionArray.length + 2] = "For each autorepair"; + return desc; + } else { + String[] desc = new String[mDescriptionArray.length + 1]; + System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); + desc[mDescriptionArray.length] = "Cannot be shared between Multiblocks!"; + return desc; + } } @Override @@ -105,7 +104,8 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - if(aTileEntity.getMetaTileID()==111) return new GT_MetaTileEntity_Hatch_Maintenance(mName, mTier, mDescriptionArray, mTextures, true); + if (aTileEntity.getMetaTileID() == 111) + return new GT_MetaTileEntity_Hatch_Maintenance(mName, mTier, mDescriptionArray, mTextures, true); return new GT_MetaTileEntity_Hatch_Maintenance(mName, mTier, mDescriptionArray, mTextures, false); } @@ -118,65 +118,65 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - if(mAuto) return new GT_Container_2by2(aPlayerInventory, aBaseMetaTileEntity); + if (mAuto) return new GT_Container_2by2(aPlayerInventory, aBaseMetaTileEntity); return new GT_Container_MaintenanceHatch(aPlayerInventory, aBaseMetaTileEntity); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - if(mAuto) return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + if (mAuto) return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); return new GT_GUIContainer_MaintenanceHatch(aPlayerInventory, aBaseMetaTileEntity); } - + public boolean autoMaintainance() { - boolean tSuccess = true; - ItemStack[] mInputs = new ItemStack[]{ItemList.Duct_Tape.get(4, new Object[]{}),GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2),GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4),GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2)}; - List aInputs = Arrays.asList(mInventory); - if (mInputs.length > 0 && aInputs == null) tSuccess = false; - int amt = 0; - for (ItemStack tStack : mInputs) { - if (tStack != null) { - amt = tStack.stackSize; - boolean temp = true; - for (ItemStack aStack : aInputs) { - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { - amt -= aStack.stackSize; - if (amt < 1) { - temp = false; - break; - } - } + boolean tSuccess = true; + ItemStack[] mInputs = new ItemStack[]{ItemList.Duct_Tape.get(4, new Object[]{}), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2)}; + List aInputs = Arrays.asList(mInventory); + if (mInputs.length > 0 && aInputs == null) tSuccess = false; + int amt = 0; + for (ItemStack tStack : mInputs) { + if (tStack != null) { + amt = tStack.stackSize; + boolean temp = true; + for (ItemStack aStack : aInputs) { + if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { + amt -= aStack.stackSize; + if (amt < 1) { + temp = false; + break; } - if (temp) tSuccess = false; } } - if(tSuccess){ - for (ItemStack tStack : mInputs) { - if (tStack != null) { - amt = tStack.stackSize; - for (ItemStack aStack : aInputs) { - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { - if (aStack.stackSize < amt){ - amt -= aStack.stackSize; - aStack.stackSize = 0; - }else{ - aStack.stackSize -= amt; - amt = 0; - break; - } + if (temp) tSuccess = false; + } + } + if (tSuccess) { + for (ItemStack tStack : mInputs) { + if (tStack != null) { + amt = tStack.stackSize; + for (ItemStack aStack : aInputs) { + if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { + if (aStack.stackSize < amt) { + amt -= aStack.stackSize; + aStack.stackSize = 0; + } else { + aStack.stackSize -= amt; + amt = 0; + break; } } } } - this.mCrowbar = true; - this.mHardHammer = true; - this.mScrewdriver = true; - this.mSoftHammer = true; - this.mSolderingTool = true; - this.mWrench = true; - return true; - } - return false; + } + this.mCrowbar = true; + this.mHardHammer = true; + this.mScrewdriver = true; + this.mSoftHammer = true; + this.mSolderingTool = true; + this.mWrench = true; + return true; + } + return false; } public void onToolClick(ItemStack aStack, EntityLivingBase aPlayer) { @@ -199,7 +199,10 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch } if (mSolderingTool && aPlayer instanceof EntityPlayerMP) { EntityPlayerMP tPlayer = (EntityPlayerMP) aPlayer; - try{GT_Mod.instance.achievements.issueAchievement(tPlayer, "maintainance");}catch(Exception e){} + try { + GT_Mod.achievements.issueAchievement(tPlayer, "maintainance"); + } catch (Exception ignored) { + } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 1445323fd5..dde8d7cf4f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -25,11 +25,11 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @Override public String[] getDescription() { - String[] desc = new String[mDescriptionArray.length + 2]; - System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); - desc[mDescriptionArray.length] = "DO NOT OBSTRUCT THE OUTPUT!"; - desc[mDescriptionArray.length + 1] = "Reduces Pollution to "+calculatePollutionReduction(100)+"%"; - return desc; + String[] desc = new String[mDescriptionArray.length + 2]; + System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); + desc[mDescriptionArray.length] = "DO NOT OBSTRUCT THE OUTPUT!"; + desc[mDescriptionArray.length + 1] = "Reduces Pollution to " + calculatePollutionReduction(100) + "%"; + return desc; } @Override @@ -68,15 +68,15 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { } public boolean polluteEnvironment() { - if(getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing())){ - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), calculatePollutionReduction(10000)); - return true; - } + if (getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing())) { + GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), calculatePollutionReduction(10000)); + return true; + } return false; } - - public int calculatePollutionReduction(int aPollution){ - return (int) (aPollution *(Math.pow(0.7, mTier-1))); + + public int calculatePollutionReduction(int aPollution) { + return (int) (aPollution * (Math.pow(0.7, mTier - 1))); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 75fbf0fd2a..3dd59126b8 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -117,8 +117,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { aNBT.setInteger("mRuntime", mRuntime); if (mOutputItems != null) { - aNBT.setInteger("mOutputItemsLength", mOutputItems.length); - for (int i = 0; i < mOutputItems.length; i++) + aNBT.setInteger("mOutputItemsLength", mOutputItems.length); + for (int i = 0; i < mOutputItems.length; i++) if (mOutputItems[i] != null) { NBTTagCompound tNBT = new NBTTagCompound(); mOutputItems[i].writeToNBT(tNBT); @@ -126,8 +126,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { } } if (mOutputFluids != null) { - aNBT.setInteger("mOutputFluidsLength", mOutputFluids.length); - for (int i = 0; i < mOutputFluids.length; i++) + aNBT.setInteger("mOutputFluidsLength", mOutputFluids.length); + for (int i = 0; i < mOutputFluids.length; i++) if (mOutputFluids[i] != null) { NBTTagCompound tNBT = new NBTTagCompound(); mOutputFluids[i].writeToNBT(tNBT); @@ -152,12 +152,12 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { mEfficiency = aNBT.getInteger("mEfficiency"); mPollution = aNBT.getInteger("mPollution"); mRuntime = aNBT.getInteger("mRuntime"); - + int aOutputItemsLength = aNBT.getInteger("mOutputItemsLength"); if (aOutputItemsLength > 0) { mOutputItems = new ItemStack[aOutputItemsLength]; for (int i = 0; i < mOutputItems.length; i++) - mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); + mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); } int aOutputFluidsLength = aNBT.getInteger("mOutputFluidsLength"); @@ -166,7 +166,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { for (int i = 0; i < mOutputFluids.length; i++) mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); } - + mWrench = aNBT.getBoolean("mWrench"); mScrewdriver = aNBT.getBoolean("mScrewdriver"); mSoftHammer = aNBT.getBoolean("mSoftHammer"); @@ -222,7 +222,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { if (isValidMetaTileEntity(tHatch)) { if (!GT_MetaTileEntity_MultiBlockBase.disableMaintenance) { - if(tHatch.mAuto && (!mWrench||!mScrewdriver||!mSoftHammer||!mHardHammer||!mSolderingTool||!mCrowbar))tHatch.autoMaintainance(); + if (tHatch.mAuto && (!mWrench || !mScrewdriver || !mSoftHammer || !mHardHammer || !mSolderingTool || !mCrowbar)) + tHatch.autoMaintainance(); if (tHatch.mWrench) mWrench = true; if (tHatch.mScrewdriver) mScrewdriver = true; if (tHatch.mSoftHammer) mSoftHammer = true; @@ -255,7 +256,10 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { if (mOutputItems != null) for (ItemStack tStack : mOutputItems) if (tStack != null) { - try{GT_Mod.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack);}catch(Exception e){} + try { + GT_Mod.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); + } catch (Exception ignored) { + } addOutput(tStack); } if (mOutputFluids != null && mOutputFluids.length == 1) { @@ -276,7 +280,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { if (mOutputFluids.length > 1) { try { GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); - } catch (Exception e) { + } catch (Exception ignored) { } } } @@ -724,7 +728,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); } return false; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java index 7a77861494..4187307c6b 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java @@ -13,7 +13,7 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit @Deprecated public final String mDescription; - + /** * A simple Description. */ @@ -37,7 +37,7 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit public GT_MetaTileEntity_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); mTier = (byte) Math.max(0, Math.min(aTier, 9)); - mDescriptionArray = aDescription == null ? new String[0] : aDescription; + mDescriptionArray = aDescription == null ? new String[0] : aDescription; mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : ""; // must always be the last call! diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index aed39defb2..2c3134816d 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -76,7 +76,7 @@ public class GT_Recipe implements Comparable { * Used for describing recipes that do not fit the default recipe pattern (for example Large Boiler Fuels) */ private String[] neiDesc = null; - + private GT_Recipe(GT_Recipe aRecipe) { mInputs = GT_Utility.copyStackArray((Object[]) aRecipe.mInputs); mOutputs = GT_Utility.copyStackArray((Object[]) aRecipe.mOutputs); @@ -93,6 +93,7 @@ public class GT_Recipe implements Comparable { mEnabled = aRecipe.mEnabled; mHidden = aRecipe.mHidden; } + protected GT_Recipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { if (aInputs == null) aInputs = new ItemStack[0]; if (aOutputs == null) aOutputs = new ItemStack[0]; @@ -330,13 +331,13 @@ public class GT_Recipe implements Comparable { boolean temp = true; amt = tFluid.amount; for (FluidStack aFluid : aFluidInputs) - if (aFluid != null && aFluid.isFluidEqual(tFluid)){ - if (aDontCheckStackSizes ){ + if (aFluid != null && aFluid.isFluidEqual(tFluid)) { + if (aDontCheckStackSizes) { temp = false; break; } amt -= aFluid.amount; - if (amt<1){ + if (amt < 1) { temp = false; break; } @@ -397,14 +398,14 @@ public class GT_Recipe implements Comparable { amt = tStack.stackSize; for (ItemStack aStack : aInputs) { if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { - if (aDontCheckStackSizes){ + if (aDontCheckStackSizes) { aStack.stackSize -= amt; break; } - if (aStack.stackSize < amt){ + if (aStack.stackSize < amt) { amt -= aStack.stackSize; aStack.stackSize = 0; - }else{ + } else { aStack.stackSize -= amt; amt = 0; break; @@ -441,15 +442,16 @@ public class GT_Recipe implements Comparable { } public String[] getNeiDesc() { - return neiDesc; - } - protected void setNeiDesc(String... neiDesc) { - this.neiDesc = neiDesc; - } + return neiDesc; + } - public static class GT_Recipe_AssemblyLine{ + protected void setNeiDesc(String... neiDesc) { + this.neiDesc = neiDesc; + } + + public static class GT_Recipe_AssemblyLine { public static final ArrayList sAssemblylineRecipes = new ArrayList(); - + public ItemStack mResearchItem; public int mResearchTime; public ItemStack[] mInputs; @@ -457,17 +459,17 @@ public class GT_Recipe implements Comparable { public ItemStack mOutput; public int mDuration; public int mEUt; - + public GT_Recipe_AssemblyLine(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) { - mResearchItem = aResearchItem; - mResearchTime = aResearchTime; - mInputs = aInputs; - mFluidInputs = aFluidInputs; - mOutput = aOutput; - mDuration = aDuration; - mEUt = aEUt; - } - + mResearchItem = aResearchItem; + mResearchTime = aResearchTime; + mInputs = aInputs; + mFluidInputs = aFluidInputs; + mOutput = aOutput; + mDuration = aDuration; + mEUt = aEUt; + } + } public static class GT_Recipe_Map { @@ -489,7 +491,7 @@ public class GT_Recipe implements Comparable { public static final GT_Recipe_Map sByProductList = new GT_Recipe_Map(new HashSet(1000), "gt.recipe.byproductlist", "Ore Byproduct List", null, RES_PATH_GUI + "basicmachines/Default", 1, 6, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sReplicatorFakeRecipes = new GT_Recipe_Map(new HashSet(100), "gt.recipe.replicator", "Replicator", null, RES_PATH_GUI + "basicmachines/Replicator", 0, 1, 0, 1, 1, E, 1, E, true, true); public static final GT_Recipe_Map sAssemblylineFakeRecipes = new GT_Recipe_Map(new HashSet(30), "gt.recipe.scanner", "Scanner", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 1, 0, 1, E, 1, E, true, true); - + public static final GT_Recipe_Map sPlasmaArcFurnaceRecipes = new GT_Recipe_Map(new HashSet(10000), "gt.recipe.plasmaarcfurnace", "Plasma Arc Furnace", null, RES_PATH_GUI + "basicmachines/PlasmaArcFurnace", 1, 4, 1, 1, 1, E, 1, E, true, true); public static final GT_Recipe_Map sArcFurnaceRecipes = new GT_Recipe_Map(new HashSet(10000), "gt.recipe.arcfurnace", "Arc Furnace", null, RES_PATH_GUI + "basicmachines/ArcFurnace", 1, 4, 1, 1, 3, E, 1, E, true, true); public static final GT_Recipe_Map sPrinterRecipes = new GT_Recipe_Map_Printer(new HashSet(100), "gt.recipe.printer", "Printer", null, RES_PATH_GUI + "basicmachines/Printer", 1, 1, 1, 1, 1, E, 1, E, true, true); @@ -545,7 +547,7 @@ public class GT_Recipe implements Comparable { public static final GT_Recipe_Map_Fuel sLargeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet(10), "gt.recipe.largenaquadahreactor", "Large Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); public static final GT_Recipe_Map_Fuel sFluidNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet(10), "gt.recipe.fluidnaquadahreactor", "Fluid Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); public static final GT_Recipe_Map_Large_Boiler_Fake_Fuels sLargeBoilerFakeFuels = new GT_Recipe_Map_Large_Boiler_Fake_Fuels(); - + /** * HashMap of Recipes based on their Items */ @@ -1378,47 +1380,46 @@ public class GT_Recipe implements Comparable { } public static class GT_Recipe_Map_Large_Boiler_Fake_Fuels extends GT_Recipe_Map { - - public GT_Recipe_Map_Large_Boiler_Fake_Fuels(){ - super(new HashSet(30), "gt.recipe.largeboilerfakefuels", "Large Boiler", null, RES_PATH_GUI + "basicmachines/Default", 1, 0, 1, 0, 1, E, 1, E, true , true); - GT_Recipe explanatoryRecipe = new GT_Recipe(true, new ItemStack[]{}, new ItemStack[]{}, null, null, null, null, 1, 1, 1); - explanatoryRecipe.setNeiDesc("Not all solid fuels are listed.", "Any item that burns in a", "vanilla furnace will burn in", "a Large Boiler."); - addRecipe(explanatoryRecipe); - } - - public GT_Recipe addDenseLiquidRecipe(GT_Recipe recipe) { - return addRecipe(recipe, ((double)recipe.mSpecialValue) / 10); - } - - public GT_Recipe addDieselRecipe(GT_Recipe recipe) { - return addRecipe(recipe,((double)recipe.mSpecialValue) / 40); - } - - public void addSolidRecipes(ItemStack ... itemStacks) { - for(ItemStack itemStack : itemStacks){ - addSolidRecipe(itemStack); - } - } - - public GT_Recipe addSolidRecipe(ItemStack fuelItemStack){ - return addRecipe(new GT_Recipe(true, new ItemStack[]{fuelItemStack}, new ItemStack[]{}, null, null, null, null, 1, 0, GT_ModHandler.getFuelValue(fuelItemStack) / 1600), ((double)GT_ModHandler.getFuelValue(fuelItemStack)) / 1600); - } - - private GT_Recipe addRecipe(GT_Recipe recipe, double baseBurnTime){ - recipe = new GT_Recipe(recipe); - - double bronzeBurnTime = baseBurnTime * 2; - double steelBurnTime = baseBurnTime * 1.5; - double titaniumBurnTime = baseBurnTime * 1.3; - double tungstensteelBurnTime = baseBurnTime * 1.2; - - recipe.setNeiDesc("Burn time in seconds:", - String.format("Bronze Boiler: %.4f", bronzeBurnTime), - String.format("Steel Boiler: %.4f", steelBurnTime), - String.format("Titanium Boiler: %.4f", titaniumBurnTime), - String.format("Tungstensteel Boiler: %.4f", tungstensteelBurnTime)); - return super.addRecipe(recipe); - } - + + public GT_Recipe_Map_Large_Boiler_Fake_Fuels() { + super(new HashSet(30), "gt.recipe.largeboilerfakefuels", "Large Boiler", null, RES_PATH_GUI + "basicmachines/Default", 1, 0, 1, 0, 1, E, 1, E, true, true); + GT_Recipe explanatoryRecipe = new GT_Recipe(true, new ItemStack[]{}, new ItemStack[]{}, null, null, null, null, 1, 1, 1); + explanatoryRecipe.setNeiDesc("Not all solid fuels are listed.", "Any item that burns in a", "vanilla furnace will burn in", "a Large Boiler."); + addRecipe(explanatoryRecipe); + } + + public GT_Recipe addDenseLiquidRecipe(GT_Recipe recipe) { + return addRecipe(recipe, ((double) recipe.mSpecialValue) / 10); + } + + public GT_Recipe addDieselRecipe(GT_Recipe recipe) { + return addRecipe(recipe, ((double) recipe.mSpecialValue) / 40); + } + + public void addSolidRecipes(ItemStack... itemStacks) { + for (ItemStack itemStack : itemStacks) { + addSolidRecipe(itemStack); + } + } + + public GT_Recipe addSolidRecipe(ItemStack fuelItemStack) { + return addRecipe(new GT_Recipe(true, new ItemStack[]{fuelItemStack}, new ItemStack[]{}, null, null, null, null, 1, 0, GT_ModHandler.getFuelValue(fuelItemStack) / 1600), ((double) GT_ModHandler.getFuelValue(fuelItemStack)) / 1600); + } + + private GT_Recipe addRecipe(GT_Recipe recipe, double baseBurnTime) { + recipe = new GT_Recipe(recipe); + + double bronzeBurnTime = baseBurnTime * 2; + double steelBurnTime = baseBurnTime * 1.5; + double titaniumBurnTime = baseBurnTime * 1.3; + double tungstensteelBurnTime = baseBurnTime * 1.2; + + recipe.setNeiDesc("Burn time in seconds:", + String.format("Bronze Boiler: %.4f", bronzeBurnTime), + String.format("Steel Boiler: %.4f", steelBurnTime), + String.format("Titanium Boiler: %.4f", titaniumBurnTime), + String.format("Tungstensteel Boiler: %.4f", tungstensteelBurnTime)); + return super.addRecipe(recipe); + } } } 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 db9e13ad83..b16986fffd 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 @@ -23,14 +23,15 @@ 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 20 Pollution per second"}, new ITexture[0]); + "An early way to get Steam Power", + "Produces 120L of Steam per second", + "Causes 20 Pollution per second"}); } public GT_MetaTileEntity_Boiler_Bronze(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } + public GT_MetaTileEntity_Boiler_Bronze(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -146,8 +147,8 @@ public class GT_MetaTileEntity_Boiler_Bronze this.mProcessingEnergy -= 1; this.mTemperature += 1; } - if(this.mProcessingEnergy>0 && (aTick % 20L == 0L)){ - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20); + if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) { + GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20); } aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); } 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 8e044c7c2a..3e5afedba2 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 @@ -23,9 +23,9 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { public GT_MetaTileEntity_Boiler_Lava(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, new String[]{ - "A Boiler running off Lava", - "Produces 600L of Steam per second", - "Causes 20 Pollution per second"}, new ITexture[0]); + "A Boiler running off Lava", + "Produces 600L of Steam per second", + "Causes 20 Pollution per second"}); } public GT_MetaTileEntity_Boiler_Lava(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -126,8 +126,8 @@ public class GT_MetaTileEntity_Boiler_Lava this.mTemperature += 1; } - if(this.mProcessingEnergy>0 && (aTick % 20L == 0L)){ - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20); + if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) { + GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20); } aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); } 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 1edfaca5a0..e8b4ed1e8f 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 @@ -19,17 +19,16 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { public GT_MetaTileEntity_Boiler_Solar(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, new String[]{ - "Steam Power by the Sun", - "Produces 120L of Steam per second", - "Calcifies over time, reducing Steam output to 40L/s", - "Break and replace to decalcify"}, - new ITexture[0]); + "Steam Power by the Sun", + "Produces 120L of Steam per second", + "Calcifies over time, reducing Steam output to 40L/s", + "Break and replace to decalcify"}); } public GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } - + public GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } @@ -68,9 +67,9 @@ public class GT_MetaTileEntity_Boiler_Solar public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Boiler_Solar(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } - + private int mRunTime = 0; - + @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); @@ -118,8 +117,8 @@ public class GT_MetaTileEntity_Boiler_Solar this.mFluid.amount -= 1; mRunTime += 1; int tOutput = 150; - if(mRunTime > 10000){ - tOutput = Math.max(50, 150 - ((mRunTime-10000)/100)); + if (mRunTime > 10000) { + tOutput = Math.max(50, 150 - ((mRunTime - 10000) / 100)); } if (this.mSteam == null) { this.mSteam = GT_ModHandler.getSteam(tOutput); 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 1e82f7efab..5d7ec97401 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 @@ -23,9 +23,9 @@ public class GT_MetaTileEntity_Boiler_Steel extends GT_MetaTileEntity_Boiler { 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 20 Pollution per second"}, new ITexture[0]); + "Faster than the Bronze Boiler", + "Produces 300L of Steam per second", + "Causes 20 Pollution per second"}); } public GT_MetaTileEntity_Boiler_Steel(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -152,8 +152,8 @@ public class GT_MetaTileEntity_Boiler_Steel this.mProcessingEnergy -= 2; this.mTemperature += 1; } - if(this.mProcessingEnergy>0 && (aTick % 20L == 0L)){ - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20); + if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) { + GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20); } aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); } 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 7b1487b3c3..503a1f7efb 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 @@ -18,15 +18,14 @@ import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGenerator { - public static final int BASE_POLLUTION = 2; - + public static final int BASE_POLLUTION = 2; + 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) (20 * BASE_POLLUTION * Math.pow(2, aTier - 1)) + " Pollution per second"}, - new ITexture[0]); + "Requires liquid Fuel", + "Causes " + (int) (20 * BASE_POLLUTION * Math.pow(2, aTier - 1)) + " Pollution per second"}); onConfigLoad(); } @@ -34,7 +33,7 @@ public class GT_MetaTileEntity_DieselGenerator super(aName, aTier, aDescription, aTextures); onConfigLoad(); } - + public GT_MetaTileEntity_DieselGenerator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); onConfigLoad(); @@ -65,7 +64,7 @@ public class GT_MetaTileEntity_DieselGenerator } public int getFuelValue(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return 0; + if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return 0; int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); @@ -113,8 +112,8 @@ public class GT_MetaTileEntity_DieselGenerator return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE)}; } - @Override - public int getPollution() { - return (int) (GT_MetaTileEntity_DieselGenerator.BASE_POLLUTION * Math.pow(2, mTier - 1)); - } + @Override + public int getPollution() { + return (int) (GT_MetaTileEntity_DieselGenerator.BASE_POLLUTION * Math.pow(2, mTier - 1)); + } } 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 14f1eb2643..293669094b 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 @@ -13,15 +13,15 @@ import gregtech.api.util.GT_Recipe; public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerator { - public static final int BASE_POLLUTION = 1; - + public static final int BASE_POLLUTION = 1; + 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) (20 * BASE_POLLUTION * Math.pow(2, aTier - 1)) + " Pollution per second"}); + "Requires flammable Gasses", + "Causes " + (int) (20 * BASE_POLLUTION * Math.pow(2, aTier - 1)) + " Pollution per second"}); onConfigLoad(); } @@ -29,7 +29,7 @@ public class GT_MetaTileEntity_GasTurbine super(aName, aTier, aDescription, aTextures); onConfigLoad(); } - + public GT_MetaTileEntity_GasTurbine(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); onConfigLoad(); @@ -100,8 +100,8 @@ public class GT_MetaTileEntity_GasTurbine return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_SIDE_ACTIVE)}; } - @Override - public int getPollution() { - return (int) (GT_MetaTileEntity_GasTurbine.BASE_POLLUTION * Math.pow(2, mTier - 1)); - } + @Override + public int getPollution() { + return (int) (GT_MetaTileEntity_GasTurbine.BASE_POLLUTION * Math.pow(2, mTier - 1)); + } } 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 8850f824be..e63fbe0579 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 @@ -18,8 +18,8 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener 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"}, new ITexture[0]); + "Converts Steam into EU", + "Base rate: 2L of Steam -> 1 EU"}); onConfigLoad(); } @@ -47,12 +47,12 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener @Override public String[] getDescription() { - 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", - (int) (4000 * (8 * Math.pow(4, mTier) + Math.pow(2, mTier)) / (600 / getEfficiency()))); - return desc; + 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", + (int) (4000 * (8 * Math.pow(4, mTier) + Math.pow(2, mTier)) / (600 / getEfficiency()))); + return desc; } public int getCapacity() { @@ -68,8 +68,8 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener } public int getFuelValue(FluidStack aLiquid) { - if(aLiquid==null)return 0; - String fluidName = aLiquid.getFluid().getUnlocalizedName(aLiquid); + if (aLiquid == null) return 0; + String fluidName = aLiquid.getFluid().getUnlocalizedName(aLiquid); return GT_ModHandler.isSteam(aLiquid) || fluidName.equals("fluid.steam") || fluidName.equals("ic2.fluidSteam") || fluidName.equals("fluid.mfr.steam.still.name") ? 3 : 0; } @@ -119,18 +119,18 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_SIDE_ACTIVE)}; } - @Override - public int getPollution() { - return 0; - } - + @Override + public int getPollution() { + return 0; + } + @Override public boolean isFluidInputAllowed(FluidStack aFluid) { - if(aFluid.getFluid().getUnlocalizedName(aFluid).equals("ic2.fluidSuperheatedSteam")){ - aFluid.amount=0; - aFluid = null; - return false; - } + if (aFluid.getFluid().getUnlocalizedName(aFluid).equals("ic2.fluidSuperheatedSteam")) { + aFluid.amount = 0; + aFluid = null; + return false; + } return super.isFluidInputAllowed(aFluid); } } 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 484195a2cd..015670cb02 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 @@ -16,188 +16,184 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBase { - private int mHeatingCapacity = 0; - - public GT_MetaTileEntity_Cleanroom(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_Cleanroom(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Cleanroom(this.mName); - } - - public String[] getDescription() { - return new String[] { - "Controller Block for the Cleanroom", - "Min(WxHxD): 3x3x3 (Hollow), Max(WxHxD): 15x15x15 (Hollow)", - "Controller (Top center), Walls Plascrete", - "Top besides contoller and corners filter casings", - "1 Reinforced Door", - "1x Energy Hatch, 1x Maintainance Hatch", - "up to 10 Machine Hull to transfer Items & Energy inside"}; - } - - public boolean checkRecipe(ItemStack aStack) { - this.mEfficiencyIncrease = 100; - this.mMaxProgresstime = 100; - this.mEUt = -4; - return true; - } - - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int x = 1; - int z = 1; - int y = 1; - int mDoorCount = 0; - int mHullCount = 0; - int mPlascreteCount = 0; - boolean doorState = false; - mUpdate = 100; - for (int i = 1; i < 8; i++) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, 0, 0); - int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0); - if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { - if (tBlock == GregTech_API.sBlockReinforced || tMeta == 2) { - x = i; - z = i; - break; - } else { - return false; - } - } - } - for (int i = -1; i > -16; i--) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(x, i, z); - int tMeta = aBaseMetaTileEntity.getMetaIDOffset(x, i, z); - if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) { - y = i + 1; - break; - } - } - if (y > -2) { - return false; - } - for (int dX = -x; dX <= x; dX++) { - for (int dZ = -z; dZ <= z; dZ++) { - for (int dY = 0; dY >= y; dY--) { - if (dX == -x || dX == x || dY == -y || dY == y || dZ == -z || dZ == z) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(dX, dY, dZ); - int tMeta = aBaseMetaTileEntity.getMetaIDOffset(dX, dY, dZ); - if (y == 0) { - if (dX == -x || dX == x || dZ == -z || dZ == z) { - if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) { - return false; - } - } else if (dX == 0 && dZ == 0) { - } else { - if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { - return false; - } - } - } else if (tBlock == GregTech_API.sBlockReinforced && tMeta == 2) { - mPlascreteCount++; - } else { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ); - if ((!addMaintenanceToMachineList(tTileEntity, 82)) && (!addEnergyInputToMachineList(tTileEntity, 82))) { - if (tBlock instanceof ic2.core.block.BlockIC2Door) { - if ((tMeta & 8) == 0) { - doorState = (Math.abs(dX) > Math.abs(dZ) == ((tMeta & 1) != 0)) != ((tMeta & 4) != 0); - } - mDoorCount++; - } else { - if (tTileEntity == null) { - { - return false; - } - } - IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicHull) { - mHullCount++; - } else { - return false; - } - } - } - } - } else { - - } - } - } - } - if (mMaintenanceHatches.size() != 1 || mEnergyHatches.size() != 1 || mDoorCount != 2 || mHullCount > 10) { - return false; - } - for (int dX = -x + 1; dX <= x - 1; dX++) { - for (int dZ = -z + 1; dZ <= z - 1; dZ++) { - for (int dY = -1; dY >= y + 1; dY--) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ); - if (tTileEntity != null) { - IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity(); - if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine_GT_Recipe) { - ((GT_MetaTileEntity_BasicMachine_GT_Recipe) aMetaTileEntity).mCleanroom = this; - } - } - } - } - } - - if (doorState) { - mEfficiency = Math.max(0, mEfficiency - 200); - } - - return true; - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == 0 || aSide == 1) { - return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.BLOCK_PLASCRETE), - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_TOP_CLEANROOM_ACTIVE : Textures.BlockIcons.OVERLAY_TOP_CLEANROOM) }; - - } - return new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.BLOCK_PLASCRETE) }; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiblockDisplay.png"); - } - - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return null; - } - - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - public int getAmountOfOutputs() { - return 0; - } - - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } -} \ No newline at end of file + private int mHeatingCapacity = 0; + + public GT_MetaTileEntity_Cleanroom(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_Cleanroom(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Cleanroom(this.mName); + } + + public String[] getDescription() { + return new String[]{ + "Controller Block for the Cleanroom", + "Min(WxHxD): 3x3x3 (Hollow), Max(WxHxD): 15x15x15 (Hollow)", + "Controller (Top center), Walls Plascrete", + "Top besides contoller and corners filter casings", + "1 Reinforced Door", + "1x Energy Hatch, 1x Maintainance Hatch", + "up to 10 Machine Hull to transfer Items & Energy inside"}; + } + + public boolean checkRecipe(ItemStack aStack) { + this.mEfficiencyIncrease = 100; + this.mMaxProgresstime = 100; + this.mEUt = -4; + return true; + } + + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int x = 1; + int z = 1; + int y = 1; + int mDoorCount = 0; + int mHullCount = 0; + int mPlascreteCount = 0; + boolean doorState = false; + mUpdate = 100; + for (int i = 1; i < 8; i++) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, 0, 0); + int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0); + if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { + if (tBlock == GregTech_API.sBlockReinforced || tMeta == 2) { + x = i; + z = i; + break; + } else { + return false; + } + } + } + for (int i = -1; i > -16; i--) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(x, i, z); + int tMeta = aBaseMetaTileEntity.getMetaIDOffset(x, i, z); + if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) { + y = i + 1; + break; + } + } + if (y > -2) { + return false; + } + for (int dX = -x; dX <= x; dX++) { + for (int dZ = -z; dZ <= z; dZ++) { + for (int dY = 0; dY >= y; dY--) { + if (dX == -x || dX == x || dY == -y || dY == y || dZ == -z || dZ == z) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(dX, dY, dZ); + int tMeta = aBaseMetaTileEntity.getMetaIDOffset(dX, dY, dZ); + if (y == 0) { + if (dX == -x || dX == x || dZ == -z || dZ == z) { + if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) { + return false; + } + } else if (dX == 0 && dZ == 0) { + } else { + if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { + return false; + } + } + } else if (tBlock == GregTech_API.sBlockReinforced && tMeta == 2) { + mPlascreteCount++; + } else { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ); + if ((!addMaintenanceToMachineList(tTileEntity, 82)) && (!addEnergyInputToMachineList(tTileEntity, 82))) { + if (tBlock instanceof ic2.core.block.BlockIC2Door) { + if ((tMeta & 8) == 0) { + doorState = (Math.abs(dX) > Math.abs(dZ) == ((tMeta & 1) != 0)) != ((tMeta & 4) != 0); + } + mDoorCount++; + } else { + if (tTileEntity == null) { + return false; + } + IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicHull) { + mHullCount++; + } else { + return false; + } + } + } + } + } + } + } + } + if (mMaintenanceHatches.size() != 1 || mEnergyHatches.size() != 1 || mDoorCount != 2 || mHullCount > 10) { + return false; + } + for (int dX = -x + 1; dX <= x - 1; dX++) { + for (int dZ = -z + 1; dZ <= z - 1; dZ++) { + for (int dY = -1; dY >= y + 1; dY--) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ); + if (tTileEntity != null) { + IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity(); + if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine_GT_Recipe) { + ((GT_MetaTileEntity_BasicMachine_GT_Recipe) aMetaTileEntity).mCleanroom = this; + } + } + } + } + } + + if (doorState) { + mEfficiency = Math.max(0, mEfficiency - 200); + } + + return true; + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == 0 || aSide == 1) { + return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.BLOCK_PLASCRETE), + new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_TOP_CLEANROOM_ACTIVE : Textures.BlockIcons.OVERLAY_TOP_CLEANROOM)}; + + } + return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.BLOCK_PLASCRETE)}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiblockDisplay.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return null; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public int getAmountOfOutputs() { + return 0; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } +} 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 d720c688d8..04922c0a03 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 @@ -38,7 +38,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler public String[] getDescription() { return new String[]{ "Controller Block for the Large Boiler", - "Produces "+(getEUt()*40)*(runtimeBoost(20)/20f)+"L of Steam with 1 Coal at "+getEUt()* 40+"L/s", + "Produces " + (getEUt() * 40) * (runtimeBoost(20) / 20f) + "L of Steam with 1 Coal at " + getEUt() * 40 + "L/s", "A programmed circuit in the main block throttles the boiler (-1000L/s per config)", "Size(WxHxD): 3x5x3, Controller (Front middle in Fireboxes)", "3x1x3 of Fire Boxes (Bottom layer, Min 3)", @@ -94,27 +94,27 @@ public abstract class GT_MetaTileEntity_LargeBoiler } public boolean checkRecipe(ItemStack aStack) { - //Do we have an integrated circuit with a valid configuration? - if (mInventory[1] != null && mInventory[1].getUnlocalizedName().startsWith("gt.integrated_circuit")) { + //Do we have an integrated circuit with a valid configuration? + if (mInventory[1] != null && mInventory[1].getUnlocalizedName().startsWith("gt.integrated_circuit")) { int circuit_config = mInventory[1].getItemDamage(); if (circuit_config >= 1 && circuit_config <= 25) { // If so, overwrite the current config - this.integratedCircuitConfig = circuit_config; - } + this.integratedCircuitConfig = circuit_config; + } } else { - //If not, set the config to zero - this.integratedCircuitConfig = 0; + //If not, set the config to zero + this.integratedCircuitConfig = 0; } - - this.mSuperEfficencyIncrease=0; + + this.mSuperEfficencyIncrease = 0; for (GT_Recipe tRecipe : GT_Recipe.GT_Recipe_Map.sDieselFuels.mRecipeList) { FluidStack tFluid = GT_Utility.getFluidForFilledItem(tRecipe.getRepresentativeInput(0), true); - if ((tFluid != null) && (tRecipe.mSpecialValue > 1)) { + if (tFluid != null && tRecipe.mSpecialValue > 1) { tFluid.amount = 1000; if (depleteInput(tFluid)) { this.mMaxProgresstime = adjustBurnTimeForConfig(runtimeBoost(tRecipe.mSpecialValue / 2)); this.mEUt = adjustEUtForConfig(getEUt()); - this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease() * 4); + this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease() * 4; return true; } } @@ -126,7 +126,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler if (depleteInput(tFluid)) { this.mMaxProgresstime = adjustBurnTimeForConfig(Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2))); this.mEUt = adjustEUtForConfig(getEUt()); - this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease()); + this.mEfficiencyIncrease = this.mMaxProgresstime * getEfficiencyIncrease(); return true; } } @@ -134,17 +134,20 @@ public abstract class GT_MetaTileEntity_LargeBoiler ArrayList tInputList = getStoredInputs(); if (!tInputList.isEmpty()) { for (ItemStack tInput : tInputList) { - 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()); + 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)}; tInput.stackSize -= 1; updateSlots(); - if(this.mEfficiencyIncrease>5000){ this.mEfficiencyIncrease=0;this.mSuperEfficencyIncrease=20;} + if (this.mEfficiencyIncrease > 5000) { + this.mEfficiencyIncrease = 0; + this.mSuperEfficencyIncrease = 20; + } return true; } } @@ -158,7 +161,8 @@ public abstract class GT_MetaTileEntity_LargeBoiler public boolean onRunningTick(ItemStack aStack) { if (this.mEUt > 0) { - if(this.mSuperEfficencyIncrease>0)this.mEfficiency = Math.min(10000, this.mEfficiency + this.mSuperEfficencyIncrease); + if (this.mSuperEfficencyIncrease > 0) + this.mEfficiency = Math.min(10000, this.mEfficiency + this.mSuperEfficencyIncrease); int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L); if (tGeneratedEU > 0) { long amount = (tGeneratedEU + 160) / 160; @@ -190,7 +194,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler int tFireboxAmount = 0; for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if ((i != 0) || (j != 0)) { + if (i != 0 || j != 0) { for (int k = 1; k <= 4; k++) { if (!addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, k, zDir + j), getCasingTextureIndex())) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, k, zDir + j) != getCasingBlock()) { @@ -225,9 +229,9 @@ public abstract class GT_MetaTileEntity_LargeBoiler } for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if ((xDir + i != 0) || (zDir + j != 0)) { + if (xDir + i != 0 || zDir + j != 0) { IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, getFireboxTextureIndex())) && (!addInputToMachineList(tTileEntity, getFireboxTextureIndex())) && (!addMufflerToMachineList(tTileEntity, getFireboxTextureIndex()))) { + if (!addMaintenanceToMachineList(tTileEntity, getFireboxTextureIndex()) && !addInputToMachineList(tTileEntity, getFireboxTextureIndex()) && !addMufflerToMachineList(tTileEntity, getFireboxTextureIndex())) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != getFireboxBlock()) { return false; } @@ -239,7 +243,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler } } } - return (tCasingAmount >= 24) && (tFireboxAmount >= 3); + return tCasingAmount >= 24 && tFireboxAmount >= 3; } public int getMaxEfficiency(ItemStack aStack) { @@ -247,7 +251,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler } public int getPollutionPerTick(ItemStack aStack) { - int adjustedEUOutput = Math.max(25, getEUt() - 25 * integratedCircuitConfig); + int adjustedEUOutput = Math.max(25, getEUt() - 25 * integratedCircuitConfig); return Math.max(1, 12 * adjustedEUOutput / getEUt()); } @@ -258,21 +262,21 @@ public abstract class GT_MetaTileEntity_LargeBoiler public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } - - private int adjustEUtForConfig(int rawEUt){ - int adjustedSteamOutput = rawEUt - 25 * integratedCircuitConfig; - return Math.max(adjustedSteamOutput, 25); + + private int adjustEUtForConfig(int rawEUt) { + int adjustedSteamOutput = rawEUt - 25 * integratedCircuitConfig; + return Math.max(adjustedSteamOutput, 25); } - - private int adjustBurnTimeForConfig(int rawBurnTime){ - if(mEfficiency < 10000){ - return rawBurnTime; - } - int adjustedEUt = Math.max(25, getEUt() - 25 * integratedCircuitConfig); - int adjustedBurnTime = rawBurnTime * getEUt() / adjustedEUt; - this.excessProjectedEU += (getEUt() * rawBurnTime) - (adjustedEUt * adjustedBurnTime); - adjustedBurnTime += this.excessProjectedEU / adjustedEUt; - this.excessProjectedEU %= adjustedEUt; - return adjustedBurnTime; + + private int adjustBurnTimeForConfig(int rawBurnTime) { + if (mEfficiency < 10000) { + return rawBurnTime; + } + int adjustedEUt = Math.max(25, getEUt() - 25 * integratedCircuitConfig); + int adjustedBurnTime = rawBurnTime * getEUt() / adjustedEUt; + this.excessProjectedEU += getEUt() * rawBurnTime - adjustedEUt * adjustedBurnTime; + adjustedBurnTime += this.excessProjectedEU / adjustedEUt; + this.excessProjectedEU %= adjustedEUt; + return adjustedBurnTime; } } \ No newline at end of file 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 ba3b41adf5..22e9a23843 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 @@ -30,10 +30,10 @@ public class GT_MetaTileEntity_Locker } public String[] getDescription() { - String[] desc = new String[mDescriptionArray.length + 1]; - System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); - desc[mDescriptionArray.length] = "Click with Screwdriver to change Style"; - return desc; + String[] desc = new String[mDescriptionArray.length + 1]; + System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); + desc[mDescriptionArray.length] = "Click with Screwdriver to change Style"; + return desc; } public ITexture[][][] getTextureSet(ITexture[] aTextures) { -- cgit From 60348c09ba6cabf571d8dcb8e0251db2bd70d511 Mon Sep 17 00:00:00 2001 From: Johannes Gäßler Date: Sat, 13 May 2017 16:37:39 +0200 Subject: Added a new recipe map for the LCR, expanded the API to allow for custom NEI stack positioning. Refactored the name of the Large Boiler Fake Fuels so they're in line with other names. Fixed a bug where the LCM was checking for the wrong casing type. --- src/main/java/gregtech/api/util/GT_Recipe.java | 152 +++++++++++++++++++-- src/main/java/gregtech/common/GT_RecipeAdder.java | 1 + .../GT_MetaTileEntity_LargeChemicalReactor.java | 4 +- .../java/gregtech/nei/GT_NEI_DefaultHandler.java | 13 +- 4 files changed, 158 insertions(+), 12 deletions(-) (limited to 'src/main/java/gregtech/api/util/GT_Recipe.java') diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 6572701348..6a8a599b39 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -1,5 +1,21 @@ package gregtech.api.util; +import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.GT_Values.D2; +import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.GT_Values.L; +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; +import static gregtech.api.enums.GT_Values.W; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +import codechicken.nei.PositionedStack; import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; import gregtech.api.enums.ItemList; @@ -11,19 +27,17 @@ import gregtech.api.objects.GT_FluidStack; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.ItemData; import gregtech.api.objects.MaterialStack; +import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; -import java.util.*; - -import static gregtech.api.enums.GT_Values.*; - /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! *

@@ -76,7 +90,7 @@ public class GT_Recipe implements Comparable { * Used for describing recipes that do not fit the default recipe pattern (for example Large Boiler Fuels) */ private String[] neiDesc = null; - + private GT_Recipe(GT_Recipe aRecipe) { mInputs = GT_Utility.copyStackArray((Object[]) aRecipe.mInputs); mOutputs = GT_Utility.copyStackArray((Object[]) aRecipe.mOutputs); @@ -449,6 +463,22 @@ public class GT_Recipe implements Comparable { this.neiDesc = neiDesc; } + /** + * Overriding this method and getOutputPositionedStacks allows for custom NEI stack placement + * @return A list of input stacks + */ + public ArrayList getInputPositionedStacks(){ + return null; + } + + /** + * Overriding this method and getInputPositionedStacks allows for custom NEI stack placement + * @return A list of output stacks + */ + public ArrayList getOutputPositionedStacks(){ + return null; + } + public static class GT_Recipe_AssemblyLine { public static final ArrayList sAssemblylineRecipes = new ArrayList(); @@ -520,6 +550,7 @@ public class GT_Recipe implements Comparable { public static final GT_Recipe_Map sImplosionRecipes = new GT_Recipe_Map(new HashSet(50), "gt.recipe.implosioncompressor", "Implosion Compressor", null, RES_PATH_GUI + "basicmachines/Default", 2, 2, 2, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sVacuumRecipes = new GT_Recipe_Map(new HashSet(100), "gt.recipe.vacuumfreezer", "Vacuum Freezer", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sChemicalRecipes = new GT_Recipe_Map(new HashSet(100), "gt.recipe.chemicalreactor", "Chemical Reactor", null, RES_PATH_GUI + "basicmachines/ChemicalReactor", 2, 2, 1, 0, 1, E, 1, E, true, true); + public static final GT_Recipe_Map sMultiblockChemicalRecipes = new GT_Recipe_Map_LargeChemicalReactor(); public static final GT_Recipe_Map sDistillationRecipes = new GT_Recipe_Map(new HashSet(50), "gt.recipe.distillationtower", "Distillation Tower", null, RES_PATH_GUI + "basicmachines/Default", 2, 4, 0, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sCrakingRecipes = new GT_Recipe_Map(new HashSet(50), "gt.recipe.craker", "Oil Cracker", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 1, 1, E, 1, E, true, true); public static final GT_Recipe_Map sPyrolyseRecipes = new GT_Recipe_Map(new HashSet(50), "gt.recipe.pyro", "Pyrolyse Oven", null, RES_PATH_GUI + "basicmachines/Default", 2, 1, 1, 0, 1, E, 1, E, true, true); @@ -546,7 +577,7 @@ public class GT_Recipe implements Comparable { public static final GT_Recipe_Map_Fuel sSmallNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet(10), "gt.recipe.smallnaquadahreactor", "Small Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); public static final GT_Recipe_Map_Fuel sLargeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet(10), "gt.recipe.largenaquadahreactor", "Large Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); public static final GT_Recipe_Map_Fuel sFluidNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet(10), "gt.recipe.fluidnaquadahreactor", "Fluid Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); - public static final GT_Recipe_Map_Large_Boiler_Fake_Fuels sLargeBoilerFakeFuels = new GT_Recipe_Map_Large_Boiler_Fake_Fuels(); + public static final GT_Recipe_Map_LargeBoilerFakeFuels sLargeBoilerFakeFuels = new GT_Recipe_Map_LargeBoilerFakeFuels(); /** * HashMap of Recipes based on their Items @@ -1379,9 +1410,9 @@ public class GT_Recipe implements Comparable { } } - public static class GT_Recipe_Map_Large_Boiler_Fake_Fuels extends GT_Recipe_Map { + public static class GT_Recipe_Map_LargeBoilerFakeFuels extends GT_Recipe_Map { - public GT_Recipe_Map_Large_Boiler_Fake_Fuels() { + public GT_Recipe_Map_LargeBoilerFakeFuels() { super(new HashSet(30), "gt.recipe.largeboilerfakefuels", "Large Boiler", null, RES_PATH_GUI + "basicmachines/Default", 1, 0, 1, 0, 1, E, 1, E, true, true); GT_Recipe explanatoryRecipe = new GT_Recipe(true, new ItemStack[]{}, new ItemStack[]{}, null, null, null, null, 1, 1, 1); explanatoryRecipe.setNeiDesc("Not all solid fuels are listed.", "Any item that burns in a", "vanilla furnace will burn in", "a Large Boiler."); @@ -1422,4 +1453,109 @@ public class GT_Recipe implements Comparable { return super.addRecipe(recipe); } } + + public static class GT_Recipe_Map_LargeChemicalReactor extends GT_Recipe_Map{ + private static int INPUT_COUNT = 2; + private static int OUTPUT_COUNT = 2; + private static int FLUID_INPUT_COUNT = 3; + private static int FLUID_OUTPUT_COUNT = 3; + + public GT_Recipe_Map_LargeChemicalReactor() { + super(new HashSet(200), "gt.recipe.largechemicalreactor", "Large Chemical Reactor", null, RES_PATH_GUI + "basicmachines/Default", INPUT_COUNT, OUTPUT_COUNT, 0, 0, 1, E, 1, E, true, true); + } + + @Override + public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + aOptimize = false; + ArrayList adjustedInputs = new ArrayList(); + ArrayList adjustedOutputs = new ArrayList(); + ArrayList adjustedFluidInputs = new ArrayList(); + ArrayList adjustedFluidOutputs = new ArrayList(); + + for (ItemStack input : aInputs) { + FluidStack inputFluidContent = FluidContainerRegistry.getFluidForFilledItem(input); + if (inputFluidContent != null) { + inputFluidContent.amount *= input.stackSize; + adjustedFluidInputs.add(inputFluidContent); + } else { + ItemData itemData = GT_OreDictUnificator.getItemData(input); + if (itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mMaterial.mMaterial == Materials.Empty) { + continue; + } else { + adjustedInputs.add(input); + } + } + } + for (FluidStack fluidInput : aFluidInputs) { + adjustedFluidInputs.add(fluidInput); + } + aInputs = adjustedInputs.toArray(new ItemStack[adjustedInputs.size()]); + aFluidInputs = adjustedFluidInputs.toArray(new FluidStack[adjustedFluidInputs.size()]); + + for (ItemStack output : aOutputs) { + FluidStack outputFluidContent = FluidContainerRegistry.getFluidForFilledItem(output); + if (outputFluidContent != null) { + outputFluidContent.amount *= output.stackSize; + adjustedFluidOutputs.add(outputFluidContent); + } else { + ItemData itemData = GT_OreDictUnificator.getItemData(output); + if (itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mMaterial.mMaterial == Materials.Empty) { + continue; + } else { + adjustedOutputs.add(output); + } + } + } + for (FluidStack fluidOutput : aFluidOutputs) { + adjustedFluidOutputs.add(fluidOutput); + } + aOutputs = adjustedOutputs.toArray(new ItemStack[adjustedOutputs.size()]); + aFluidOutputs = adjustedFluidOutputs.toArray(new FluidStack[adjustedFluidOutputs.size()]); + + return addRecipe(new GT_Recipe_LargeChemicalReactor(aOptimize, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + } + + private static class GT_Recipe_LargeChemicalReactor extends GT_Recipe{ + + protected GT_Recipe_LargeChemicalReactor(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + super(aOptimize, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); + } + + @Override + public ArrayList getInputPositionedStacks() { + int itemLimit = Math.min(mInputs.length, INPUT_COUNT); + int fluidLimit = Math.min(mFluidInputs.length, FLUID_INPUT_COUNT); + ArrayList inputStacks = new ArrayList(itemLimit + fluidLimit); + + for (int i = 0; i < itemLimit; i++) { + inputStacks.add(new FixedPositionedStack(this.getRepresentativeInput(i), 48 - i * 18, 5)); + } + + for (int i = 0; i < fluidLimit; i++) { + inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(this.mFluidInputs[i], true), 48 - i * 18, 23)); + } + + return inputStacks; + } + + @Override + public ArrayList getOutputPositionedStacks() { + int itemLimit = Math.min(mOutputs.length, OUTPUT_COUNT); + int fluidLimit = Math.min(mFluidOutputs.length, FLUID_OUTPUT_COUNT); + ArrayList outputStacks = new ArrayList(itemLimit + fluidLimit); + + for (int i = 0; i < itemLimit; i++) { + outputStacks.add(new FixedPositionedStack(this.getOutput(i), 102 + i * 18, 5)); + } + + for (int i = 0; i < fluidLimit; i++) { + outputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(this.mFluidOutputs[i], true), 102 + i * 18, 23)); + } + + return outputStacks; + } + + + } + } } diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index bd9ff07f52..fbd57a8c74 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -114,6 +114,7 @@ public class GT_RecipeAdder return false; } GT_Recipe.GT_Recipe_Map.sChemicalRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput, aOutput2}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUtick, 0); + GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2}, new ItemStack[]{aOutput, aOutput2}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUtick, 0); 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 a110300c0f..db3841b394 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 @@ -109,7 +109,7 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu if (inputs.length > 0 || fluids.length > 0) { long voltage = getMaxInputVoltage(); byte tier = (byte) Math.max(1, GT_Utility.getTier(voltage)); - GT_Recipe recipe = GT_Recipe.GT_Recipe_Map.sChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tier], fluids, inputs); + GT_Recipe recipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tier], fluids, inputs); if (recipe != null && recipe.isRecipeInputEqual(true, fluids, inputs)) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; @@ -154,7 +154,7 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu if (!addInputToMachineList(tileEntity, CASING_INDEX) && !addOutputToMachineList(tileEntity, CASING_INDEX) && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { - if (block == GregTech_API.sBlockCasings2 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 14) { casingAmount++; } else { return false; diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java index 193e8432d1..26bc6a187b 100644 --- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java @@ -359,13 +359,22 @@ public class GT_NEI_DefaultHandler public class CachedDefaultRecipe extends TemplateRecipeHandler.CachedRecipe { public final GT_Recipe mRecipe; - public final List mOutputs = new ArrayList(); - public final List mInputs = new ArrayList(); + public final List mOutputs; + public final List mInputs; public CachedDefaultRecipe(GT_Recipe aRecipe) { super(); this.mRecipe = aRecipe; + if (aRecipe.getInputPositionedStacks() != null && aRecipe.getOutputPositionedStacks() != null) { + mInputs = aRecipe.getInputPositionedStacks(); + mOutputs = aRecipe.getOutputPositionedStacks(); + return; + } + + mOutputs = new ArrayList(); + mInputs = new ArrayList(); + int tStartIndex = 0; switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount) { case 0: -- cgit From 17edbc2d4840a19a435973003f756acdfa6e393f Mon Sep 17 00:00:00 2001 From: Johannes Gäßler Date: Sat, 13 May 2017 17:51:51 +0200 Subject: Fixed a bug that caused there to be two identical recipes for TiF4 --- src/main/java/gregtech/api/util/GT_Recipe.java | 12 +++++++++++- .../gregtech/loaders/postload/GT_MachineRecipeLoader.java | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/main/java/gregtech/api/util/GT_Recipe.java') diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 6a8a599b39..23d5c12110 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -20,6 +20,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.SubTag; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; @@ -1482,7 +1483,16 @@ public class GT_Recipe implements Comparable { if (itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mMaterial.mMaterial == Materials.Empty) { continue; } else { - adjustedInputs.add(input); + if (itemData != null && itemData.hasValidPrefixMaterialData() && itemData.mPrefix == OrePrefixes.cell) { + ItemStack dustStack = itemData.mMaterial.mMaterial.getDust(input.stackSize); + if (dustStack != null) { + adjustedInputs.add(dustStack); + } else { + adjustedInputs.add(input); + } + } else { + adjustedInputs.add(input); + } } } } diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index fc83bc29fa..657cfe58f5 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -1135,8 +1135,8 @@ if(Loader.isModLoaded("Railcraft")){ GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Oxygen, 1L), GT_Values.NI, Materials.Hydrogen.getGas(2000L), GT_ModHandler.getDistilledWater(1000L), ItemList.Cell_Empty.get(1L, new Object[0]), 10); GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Hydrogen, 1L), GT_Values.NI, Materials.Oxygen.getGas(500L), GT_ModHandler.getDistilledWater(500L), ItemList.Cell_Empty.get(1L, new Object[0]), 5); GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Tin, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Saltpeter, 1L), Materials.Glass.getMolten(864L), GT_Values.NF, GT_ModHandler.getModItem("Railcraft", "tile.railcraft.glass", 6L), 50); - GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Rutile, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 2L), Materials.Chlorine.getGas(4000L), Materials.Titaniumtetrachloride.getFluid(1000L), GT_Values.NI, 500, 480); GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Rutile, 1L), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Carbon, 2L), Materials.Chlorine.getGas(4000L), Materials.Titaniumtetrachloride.getFluid(1000L), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.CarbonMonoxide, 2L), 500, 480); + GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Rutile, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 2L), Materials.Chlorine.getGas(4000L), Materials.Titaniumtetrachloride.getFluid(1000L), GT_Values.NI, 500, 480); GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sodium, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Magnesiumchloride, 2L), GT_Values.NF, Materials.Chlorine.getGas(3000L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Magnesium, 6L), 300, 240); GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.RawRubber, 9L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sulfur, 1L), GT_Values.NF, Materials.Rubber.getMolten(1296L), GT_Values.NI, 600, 16); -- cgit