From ae471ca1a821a9432e9bf34d86f2c4395a3956ca Mon Sep 17 00:00:00 2001 From: Muramasa Date: Thu, 28 Jul 2016 04:15:24 +0100 Subject: Worldgen and random changes --- src/main/java/gregtech/api/util/GT_BaseCrop.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/api/util/GT_BaseCrop.java b/src/main/java/gregtech/api/util/GT_BaseCrop.java index c106816ba2..0171e35ff2 100644 --- a/src/main/java/gregtech/api/util/GT_BaseCrop.java +++ b/src/main/java/gregtech/api/util/GT_BaseCrop.java @@ -177,7 +177,7 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { @Override public ItemStack getGain(ICropTile aCrop) { int tDrop = 0; - if (mSpecialDrops != null && (tDrop = new Random().nextInt((mSpecialDrops.length*2) + 2)) < mSpecialDrops.length && mSpecialDrops[tDrop] != null) { + if (mSpecialDrops != null && (tDrop = java.util.concurrent.ThreadLocalRandom.current().nextInt(0, (mSpecialDrops.length*2) + 2)) < mSpecialDrops.length && mSpecialDrops[tDrop] != null) { return GT_Utility.copy(mSpecialDrops[tDrop]); } return GT_Utility.copy(mDrop); -- cgit From 436389d3f1d9ea12d05eb171eac80f30b6015d69 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sat, 13 Aug 2016 02:51:40 +0100 Subject: For Loop Changes --- src/main/java/gregtech/GT_Mod.java | 3 +- src/main/java/gregtech/api/enums/Materials.java | 7 +-- .../gregtech/api/items/GT_MetaGenerated_Item.java | 6 ++- .../java/gregtech/api/objects/GT_ArrayList.java | 9 ++-- src/main/java/gregtech/api/util/GT_ModHandler.java | 55 ++++++++++------------ .../java/gregtech/common/GT_Worldgenerator.java | 5 +- .../items/behaviors/Behaviour_DataStick.java | 4 +- .../common/items/behaviors/Behaviour_Scanner.java | 3 +- .../multi/GT_MetaTileEntity_DistillationTower.java | 3 +- .../GT_MetaTileEntity_ElectricBlastFurnace.java | 24 +++++----- .../multi/GT_MetaTileEntity_FusionComputer.java | 21 +++++---- .../GT_MetaTileEntity_ImplosionCompressor.java | 9 ++-- .../multi/GT_MetaTileEntity_LargeTurbine_Gas.java | 3 +- .../GT_MetaTileEntity_LargeTurbine_Plasma.java | 3 +- .../gregtech/loaders/misc/GT_Achievements.java | 14 +++--- .../loaders/oreprocessing/ProcessingDust.java | 3 +- 16 files changed, 95 insertions(+), 77 deletions(-) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 158738bdb3..44cd386c93 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -348,7 +348,8 @@ public class GT_Mod List tModList = tLoadController.getActiveModList(); List tNewModsList = new ArrayList(); ModContainer tGregTech = null; - for (short i = 0; i < tModList.size(); i = (short) (i + 1)) { + short tModList_sS= (short) tModList.size(); + for (short i = 0; i < tModList_sS; i = (short) (i + 1)) { ModContainer tMod = (ModContainer) tModList.get(i); if (tMod.getModId().equalsIgnoreCase("gregtech")) { tGregTech = tMod; diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 525dd0fb72..a3ef13b9fd 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -1,7 +1,5 @@ package gregtech.api.enums; -import java.util.*; - import cpw.mods.fml.common.Loader; import gregtech.api.GregTech_API; import gregtech.api.enums.TC_Aspects.TC_AspectStack; @@ -17,6 +15,8 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; +import java.util.*; + import static gregtech.api.enums.GT_Values.M; import static gregtech.api.enums.GT_Values.MOD_ID_TC; @@ -1536,7 +1536,8 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer { public boolean remove(ItemStack aStack) { if (aStack == null) return false; boolean temp = false; - for (int i = 0; i < mMaterialItems.size(); i++) + int mMaterialItems_sS=mMaterialItems.size(); + for (int i = 0; i < mMaterialItems_sS; i++) if (GT_Utility.areStacksEqual(aStack, mMaterialItems.get(i))) { mMaterialItems.remove(i--); temp = true; diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java index a246e83d7a..72b1485a8b 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java @@ -299,7 +299,8 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements @Override @SideOnly(Side.CLIENT) public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { - for (int i = 0, j = mEnabledItems.length(); i < j; i++) + int j = mEnabledItems.length(); + for (int i = 0; i < j; i++) if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) { Long[] tStats = mElectricStats.get((short) (mOffset + i)); if (tStats != null && tStats[3] < 0) { @@ -319,7 +320,8 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements @Override @SideOnly(Side.CLIENT) public final void registerIcons(IIconRegister aIconRegister) { - for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++) + short j = (short) mEnabledItems.length(); + for (short i = 0; i < j; i++) if (mEnabledItems.get(i)) { for (byte k = 1; k < mIconList[i].length; k++) { mIconList[i][k] = aIconRegister.registerIcon(RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i + "/" + k)); diff --git a/src/main/java/gregtech/api/objects/GT_ArrayList.java b/src/main/java/gregtech/api/objects/GT_ArrayList.java index 5bc781e281..d16974bc78 100644 --- a/src/main/java/gregtech/api/objects/GT_ArrayList.java +++ b/src/main/java/gregtech/api/objects/GT_ArrayList.java @@ -6,6 +6,7 @@ import java.util.Collection; public class GT_ArrayList extends ArrayList { private static final long serialVersionUID = 1L; + private int size_sS; private final boolean mAllowNulls; @@ -17,13 +18,13 @@ public class GT_ArrayList extends ArrayList { public GT_ArrayList(boolean aAllowNulls, E... aArray) { super(Arrays.asList(aArray)); mAllowNulls = aAllowNulls; - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}} } public GT_ArrayList(boolean aAllowNulls, Collection aList) { super(aList); mAllowNulls = aAllowNulls; - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}} } @Override @@ -46,14 +47,14 @@ public class GT_ArrayList extends ArrayList { @Override public boolean addAll(Collection aList) { boolean rReturn = super.addAll(aList); - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}} return rReturn; } @Override public boolean addAll(int aIndex, Collection aList) { boolean rReturn = super.addAll(aIndex, aList); - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}} return rReturn; } } \ No newline at end of file diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index be85ca29ce..8162360fcd 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -951,11 +951,12 @@ public class GT_ModHandler { if (aOnlyAddIfThereIsAnyRecipeOutputtingThis && !tThereWasARecipe) { ArrayList tList = (ArrayList) CraftingManager.getInstance().getRecipeList(); - for (int i = 0; i < tList.size() && !tThereWasARecipe; i++) { + int tList_sS=tList.size(); + for (int i = 0; i < tList_sS && !tThereWasARecipe; i++) { IRecipe tRecipe = tList.get(i); if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) continue; if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tRecipe.getRecipeOutput()), aResult, true)) { - tList.remove(i--); + tList.remove(i--); tList_sS=tList.size(); tThereWasARecipe = true; } } @@ -1091,18 +1092,16 @@ public class GT_ModHandler { }, 3, 3); for (int i = 0; i < aRecipe.length && i < 9; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); ArrayList tList = (ArrayList) CraftingManager.getInstance().getRecipeList(); - for (int i = 0; i < tList.size(); i++) { - try { - for (; i < tList.size(); i++) { + int tList_sS=tList.size(); + try { + for (int i = 0; i < tList_sS; i++) { + for (; i < tList_sS; i++) { if ((!(tList.get(i) instanceof IGT_CraftingRecipe) || ((IGT_CraftingRecipe) tList.get(i)).isRemovable()) && tList.get(i).matches(aCrafting, DW)) { rReturn = tList.get(i).getCraftingResult(aCrafting); - if (rReturn != null) tList.remove(i--); + if (rReturn != null) tList.remove(i--); tList_sS=tList.size(); } } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - } + }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} return rReturn; } @@ -1121,7 +1120,8 @@ public class GT_ModHandler { boolean rReturn = false; ArrayList tList = (ArrayList) CraftingManager.getInstance().getRecipeList(); aOutput = GT_OreDictUnificator.get(aOutput); - for (int i = 0; i < tList.size(); i++) { + int tList_sS=tList.size(); + for (int i = 0; i < tList_sS; i++) { IRecipe tRecipe = tList.get(i); if (aNotRemoveShapelessRecipes && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) continue; @@ -1132,7 +1132,7 @@ public class GT_ModHandler { } ItemStack tStack = tRecipe.getRecipeOutput(); if ((!(tRecipe instanceof IGT_CraftingRecipe) || ((IGT_CraftingRecipe) tRecipe).isRemovable()) && GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tStack), aOutput, aIgnoreNBT)) { - tList.remove(i--); + tList.remove(i--); tList_sS=tList.size(); rReturn = true; } } @@ -1169,11 +1169,12 @@ public class GT_ModHandler { sAllRecipeList.clear(); sAllRecipeList.addAll(tList); } - for (int i = 0, j = sAllRecipeList.size(); i < j; i++) { + int sAllRecipeList_sS=sAllRecipeList.size(); + for (int i = 0, j = sAllRecipeList_sS; i < j; i++) { IRecipe tRecipe = sAllRecipeList.get(i); if (tRecipe.matches(aCrafting, aWorld)) { if (i > 10) { - sAllRecipeList.remove(i); + sAllRecipeList.remove(i); sAllRecipeList_sS=sAllRecipeList.size(); sAllRecipeList.add(i - 10, tRecipe); } return tRecipe.getCraftingResult(aCrafting); @@ -1233,13 +1234,11 @@ public class GT_ModHandler { }, 3, 3); for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); ArrayList tList = (ArrayList) CraftingManager.getInstance().getRecipeList(); - for (int i = 0; i < tList.size(); i++) { + int tList_sS=tList.size(); + try { + for (int i = 0; i < tList_sS; i++) { temp = false; - try { - temp = tList.get(i).matches(aCrafting, DW); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } + temp = tList.get(i).matches(aCrafting, DW); if (temp) { ItemStack tOutput = aUncopiedStack ? tList.get(i).getRecipeOutput() : tList.get(i).getCraftingResult(aCrafting); if (tOutput == null || tOutput.stackSize <= 0) { @@ -1251,7 +1250,7 @@ public class GT_ModHandler { return GT_Utility.copy(tOutput); } } - } + }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} return null; } @@ -1335,13 +1334,11 @@ public class GT_ModHandler { } }, 3, 3); for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); - for (int i = 0; i < aList.size(); i++) { + int aList_sS=aList.size(); + try { + for (int i = 0; i < aList_sS; i++) { temp = false; - try { - temp = aList.get(i).matches(aCrafting, DW); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } + temp = aList.get(i).matches(aCrafting, DW); if (temp) { ItemStack tOutput = aList.get(i).getCraftingResult(aCrafting); if (tOutput == null || tOutput.stackSize <= 0) { @@ -1350,10 +1347,10 @@ public class GT_ModHandler { throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that."); } else { rList.add(GT_Utility.copy(tOutput)); - if (aDeleteFromList) aList.remove(i--); + if (aDeleteFromList) aList.remove(i--); aList_sS=aList.size(); } } - } + }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} return rList; } diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index 16872e9c21..9a5b2b3192 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -44,7 +44,8 @@ public class GT_Worldgenerator this.mList.add(new WorldGenContainer(new XSTR(aRandom.nextInt()), aX * 16, aZ * 16, ((aChunkGenerator instanceof ChunkProviderEnd)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.sky) ? 1 : ((aChunkGenerator instanceof ChunkProviderHell)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.hell) ? -1 : 0, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName)); if (!this.mIsGenerating) { this.mIsGenerating = true; - for (int i = 0; i < this.mList.size(); i++) { + int mList_sS=this.mList.size(); + for (int i = 0; i < mList_sS; i++) { ((Runnable) this.mList.get(i)).run(); } this.mList.clear(); @@ -120,7 +121,7 @@ public class GT_Worldgenerator int tDimensionType = this.mWorld.provider.dimensionId; Random aRandom = new Random(); if (((tDimensionType == 1) && endAsteroids && ((mEndAsteroidProbability <= 1) || (aRandom.nextInt(mEndAsteroidProbability) == 0)))) { - short primaryMeta = 0; + short primaryMeta = 0; short secondaryMeta = 0; short betweenMeta = 0; short sporadicMeta = 0; diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java index d56d3f38fe..809d7f806c 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java @@ -24,8 +24,8 @@ public class Behaviour_DataStick tString = GT_Utility.ItemNBT.getPunchCardData(aStack); if (GT_Utility.isStringValid(tString)) { aList.add("Punch Card Data"); - int i = 0; - for (int j = tString.length(); i < j; i += 64) { + int i = 0;int j = tString.length(); + for (; i < j; i += 64) { aList.add(tString.substring(i, Math.min(i + 64, j))); } } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java index a7c12f5a80..69ae1edb43 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java @@ -22,7 +22,8 @@ public class Behaviour_Scanner if (((aPlayer instanceof EntityPlayerMP)) && (aItem.canUse(aStack, 20000.0D))) { ArrayList tList = new ArrayList(); if (aItem.use(aStack, GT_Utility.getCoordinateScan(tList, aPlayer, aWorld, 1, aX, aY, aZ, aSide, hitX, hitY, hitZ), aPlayer)) { - for (int i = 0; i < tList.size(); i++) { + int tList_sS=tList.size(); + for (int i = 0; i < tList_sS; i++) { GT_Utility.sendChatToPlayer(aPlayer, (String) tList.get(i)); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java index 654e9df0bc..00668ffba8 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java @@ -159,7 +159,8 @@ public class GT_MetaTileEntity_DistillationTower return false; } GT_MetaTileEntity_Hatch_Output[] tmpHatches = new GT_MetaTileEntity_Hatch_Output[5]; - for (int i = 0; i < this.mOutputHatches.size(); i++) { + int mOutputHatches_sS=this.mOutputHatches.size(); + for (int i = 0; i < mOutputHatches_sS; i++) { int hatchNumber = this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height; if (tmpHatches[hatchNumber] == null) { tmpHatches[hatchNumber] = this.mOutputHatches.get(i); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java index 1b6b2d1b96..7e1abc30e7 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java @@ -1,8 +1,5 @@ package gregtech.common.tileentities.machines.multi; -import java.util.ArrayList; -import java.util.Arrays; - import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -19,6 +16,9 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; +import java.util.ArrayList; +import java.util.Arrays; + public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_MultiBlockBase { private int mHeatingCapacity = 0; @@ -73,13 +73,14 @@ public class GT_MetaTileEntity_ElectricBlastFurnace public boolean checkRecipe(ItemStack aStack) { ArrayList tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { + int tInputList_sS=tInputList.size(); + for (int i = 0; i < tInputList_sS - 1; i++) { + for (int j = i + 1; j < tInputList_sS; j++) { if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); + tInputList.remove(j--); tInputList_sS=tInputList.size(); } else { - tInputList.remove(i--); + tInputList.remove(i--); tInputList_sS=tInputList.size(); break; } } @@ -88,13 +89,14 @@ public class GT_MetaTileEntity_ElectricBlastFurnace ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); ArrayList tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { + int tFluidList_sS=tFluidList.size(); + for (int i = 0; i < tFluidList_sS - 1; i++) { + for (int j = i + 1; j < tFluidList_sS; j++) { if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); + tFluidList.remove(j--); tFluidList_sS=tFluidList.size(); } else { - tFluidList.remove(i--); + tFluidList.remove(i--); tFluidList_sS=tFluidList.size(); break; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java index d28ef0fc53..7e1113f635 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java @@ -105,19 +105,22 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity && (addIfInjector(xCenter - 6, yCenter - 1, zCenter - 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter - 1, zCenter - 1, aBaseMetaTileEntity)) && (this.mEnergyHatches.size() >= 1) && (this.mOutputHatches.size() >= 1) && (this.mInputHatches.size() >= 2)) { if (this.mEnergyHatches != null) { - for (int i = 0; i < this.mEnergyHatches.size(); i++) { + int mEnergyHatches_sS=this.mEnergyHatches.size(); + for (int i = 0; i < mEnergyHatches_sS; i++) { if (this.mEnergyHatches.get(i).mTier < tier()) return false; } } if (this.mOutputHatches != null) { - for (int i = 0; i < this.mOutputHatches.size(); i++) { + int mOutputHatches_sS=this.mOutputHatches.size(); + for (int i = 0; i < mOutputHatches_sS; i++) { if (this.mOutputHatches.get(i).mTier < tier()) return false; } } if (this.mInputHatches != null) { - for (int i = 0; i < this.mInputHatches.size(); i++) { + int mInputHatches_sS=this.mInputHatches.size(); + for (int i = 0; i < mInputHatches_sS; i++) { if (this.mInputHatches.get(i).mTier < tier()) return false; } @@ -135,7 +138,8 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity private boolean checkTier(byte tier, ArrayList list) { if (list != null) { - for (int i = 0; i < list.size(); i++) { + int list_sS=list.size(); + for (int i = 0; i < list_sS; i++) { if (list.get(i).mTier < tier) { return false; } @@ -251,13 +255,14 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity @Override public boolean checkRecipe(ItemStack aStack) { ArrayList tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { + int tFluidList_sS=tFluidList.size(); + for (int i = 0; i < tFluidList_sS - 1; i++) { + for (int j = i + 1; j < tFluidList_sS; j++) { if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); + tFluidList.remove(j--); tFluidList_sS=tFluidList.size(); } else { - tFluidList.remove(i--); + tFluidList.remove(i--); tFluidList_sS=tFluidList.size(); break; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java index 2769944f36..4ac4a227d1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java @@ -69,13 +69,14 @@ public class GT_MetaTileEntity_ImplosionCompressor public boolean checkRecipe(ItemStack aStack) { ArrayList tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { + int tInputList_sS=tInputList.size(); + for (int i = 0; i < tInputList_sS - 1; i++) { + for (int j = i + 1; j < tInputList_sS; j++) { if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); + tInputList.remove(j--); tInputList_sS=tInputList.size(); } else { - tInputList.remove(i--); + tInputList.remove(i--); tInputList_sS=tInputList.size(); break; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java index 347d883e0d..abb6dfa4c9 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java @@ -95,7 +95,8 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT int flow = 0; int totalFlow = 0; - for (int i = 0; i < aFluids.size(); i++) { + int aFluids_sS=aFluids.size(); + for (int i = 0; i < aFluids_sS; i++) { if (aFluids.get(i).isFluidEqual(firstFuelType)) { flow = aFluids.get(i).amount; // Get all (steam) in hatch flow = Math.min(flow, Math.min(remainingFlow, (int) (actualOptimalFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java index c6ee205b1b..798be9dc9a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java @@ -99,7 +99,8 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar int flow = 0; int totalFlow = 0; - for (int i = 0; i < aFluids.size(); i++) { + int aFluids_sS=aFluids.size(); + for (int i = 0; i < aFluids_sS; i++) { if (aFluids.get(i).isFluidEqual(firstFuelType)) { flow = aFluids.get(i).amount; // Get all (steam) in hatch flow = Math.min(flow, Math.min(remainingFlow, GT_Utility.safeInt((long)(actualOptimalFlow * 1.25f)))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow diff --git a/src/main/java/gregtech/loaders/misc/GT_Achievements.java b/src/main/java/gregtech/loaders/misc/GT_Achievements.java index c02743270c..f16aa8a00d 100644 --- a/src/main/java/gregtech/loaders/misc/GT_Achievements.java +++ b/src/main/java/gregtech/loaders/misc/GT_Achievements.java @@ -1,9 +1,5 @@ package gregtech.loaders.misc; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -33,6 +29,10 @@ import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.fluids.FluidStack; import thaumcraft.api.ThaumcraftApiHelper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + public class GT_Achievements { public static List oreList = new ArrayList(); @@ -46,7 +46,8 @@ public class GT_Achievements { public GT_Achievements() { this.achievementList = new HashMap(); this.issuedAchievements = new HashMap(); - for (int i = 0; i < oreList.size(); i++) { + int oreList_sS=oreList.size(); + for (int i = 0; i < oreList_sS; i++) { if (GT_Values.D1 && this.achievementList.get(oreList.get(i).name()) == null) { GT_Log.out.println("achievement." + oreList.get(i).name() + "=Find " + oreList.get(i).name() + " Ore"); @@ -497,7 +498,8 @@ public class GT_Achievements { } } else if (data.mPrefix == OrePrefixes.ore || data.mPrefix == OrePrefixes.oreBlackgranite || data.mPrefix == OrePrefixes.oreEndstone || data.mPrefix == OrePrefixes.oreNetherrack || data.mPrefix == OrePrefixes.oreRedgranite) { - for (int i = 0; i < data.getAllMaterialStacks().size(); i++) { + int data_getAllMaterialStacks_sS=data.getAllMaterialStacks().size(); + for (int i = 0; i < data_getAllMaterialStacks_sS; i++) { issueAchievement(player, data.getAllMaterialStacks().get(i).mMaterial.name()); if (data.getAllMaterialStacks().get(i).mMaterial == Materials.AnyIron) { issueAchievement(player, "iron"); diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java index ee9665d8fa..fd8d327e17 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java @@ -88,7 +88,8 @@ public class ProcessingDust implements gregtech.api.interfaces.IOreRecipeRegistr tItemAmount = (tItemAmount * tDensityMultiplier % aMaterial.getDensity() > 0L ? 1 : 0) + tItemAmount * tDensityMultiplier / aMaterial.getDensity(); if (tList.size() > 0) { FluidStack tFluid = null; - for (int i = 0; i < tList.size(); i++) { + int tList_sS=tList.size(); + for (int i = 0; i < tList_sS; i++) { if ((!ItemList.Cell_Air.isStackEqual(tList.get(i))) && ((tFluid = GT_Utility.getFluidForFilledItem((ItemStack) tList.get(i), true)) != null)) { tFluid.amount *= ((ItemStack) tList.get(i)).stackSize; tCapsuleCount -= GT_ModHandler.getCapsuleCellContainerCountMultipliedWithStackSize(new ItemStack[]{(ItemStack) tList.get(i)}); -- cgit From a2b3a339635b279cceeaaee200951d220457fe2c Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sat, 13 Aug 2016 04:16:55 +0100 Subject: Postinit reduction and save registered recipes. --- src/main/java/gregtech/GT_Mod.java | 5 +- src/main/java/gregtech/api/util/GT_ModHandler.java | 143 +++++++++++++++++---- .../gregtech/api/util/GT_RecipeRegistrator.java | 63 +++++---- 3 files changed, 164 insertions(+), 47 deletions(-) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 44cd386c93..5e6136b8a8 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -459,7 +459,10 @@ public class GT_Mod FMLLog.info("If your Log stops here, you were too impatient. Wait a bit more next time, before killing Minecraft with the Task Manager.", new Object[0]); gregtechproxy.activateOreDictHandler(); FMLLog.info("Congratulations, you have been waiting long enough. Have a Cake.", new Object[0]); - GT_Log.out.println("GT_Mod: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList.size() + " Recipes were left unused."); + GT_Log.out.println("GT_Mod: List of Lists of Tool Recipes: "+GT_ModHandler.sSingleNonBlockDamagableRecipeList_list.toString()); + GT_Log.out.println("GT_Mod: Vanilla Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sVanillaRecipeList_warntOutput.toString()); + GT_Log.out.println("GT_Mod: Single Non Block Damagable Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList_warntOutput.toString()); + GT_Log.out.println("GT_Mod: sRodMaterialList cycles: " + GT_RecipeRegistrator.sRodMaterialList_cycles); if (GT_Values.D1) { IRecipe tRecipe; for (Iterator i$ = GT_ModHandler.sSingleNonBlockDamagableRecipeList.iterator(); i$.hasNext(); GT_Log.out.println("=> " + tRecipe.getRecipeOutput().getDisplayName())) { diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 8162360fcd..a8c9eeea3a 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -52,7 +52,7 @@ import static gregtech.api.enums.GT_Values.*; public class GT_ModHandler { public static final List sSingleNonBlockDamagableRecipeList = new ArrayList(1000); private static final Map sIC2ItemMap = new HashMap(); - private static final List sAllRecipeList = Collections.synchronizedList(new ArrayList(5000)), sBufferRecipeList = new ArrayList(1000); + private static final List sAllRecipeList = /*Collections.synchronizedList(*/new ArrayList(5000)/*)*/, sBufferRecipeList = new ArrayList(1000); public static volatile int VERSION = 509; public static Collection sNativeRecipeClasses = new HashSet(), sSpecialRecipeClasses = new HashSet(); public static GT_HashSet sNonReplaceableItems = new GT_HashSet(); @@ -64,6 +64,62 @@ public class GT_ModHandler { private static Map sThermalCentrifugeRecipes = new HashMap(); private static Map sMassfabRecipes = new HashMap(); private static boolean sBufferCraftingRecipes = true; + public static List sSingleNonBlockDamagableRecipeList_list = new ArrayList(100); + private static boolean sSingleNonBlockDamagableRecipeList_create = true; + private static final ItemStack sMt1 = new ItemStack(Blocks.dirt, 1, 0), sMt2 = new ItemStack(Blocks.dirt, 1, 0); + private static final String s_H = "h", s_F = "f", s_I = "I", s_P = "P", s_R = "R"; + private static final ItemStack[][] + sShapes1 = new ItemStack[][]{ + {sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null}, + {sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1}, + {null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1}, + {sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null}, + {sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1}, + {sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1}, + {null, null, null, sMt1, null, sMt1, sMt1, null, sMt1}, + {null, sMt1, null, null, sMt1, null, null, sMt2, null}, + {sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null}, + {null, sMt1, null, null, sMt2, null, null, sMt2, null}, + {sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null}, + {null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null}, + {sMt1, sMt1, null, null, sMt2, null, null, sMt2, null}, + {null, sMt1, sMt1, null, sMt2, null, null, sMt2, null}, + {null, sMt1, null, sMt1, null, null, null, sMt1, sMt2}, + {null, sMt1, null, null, null, sMt1, sMt2, sMt1, null}, + {null, sMt1, null, sMt1, null, sMt1, null, null, sMt2}, + {null, sMt1, null, sMt1, null, sMt1, sMt2, null, null}, + {null, sMt2, null, null, sMt1, null, null, sMt1, null}, + {null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1}, + {null, sMt2, null, null, sMt2, null, null, sMt1, null}, + {null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null}, + {null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1}, + {null, sMt2, null, null, sMt2, null, sMt1, sMt1, null}, + {sMt1, null, null, null, sMt2, null, null, null, sMt2}, + {null, null, sMt1, null, sMt2, null, sMt2, null, null}, + {sMt1, null, null, null, sMt2, null, null, null, null}, + {null, null, sMt1, null, sMt2, null, null, null, null}, + {sMt1, sMt2, null, null, null, null, null, null, null}, + {sMt2, sMt1, null, null, null, null, null, null, null}, + {sMt1, null, null, sMt2, null, null, null, null, null}, + {sMt2, null, null, sMt1, null, null, null, null, null}, + {sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null}, + {sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null}, + {null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1}, + {null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1}, + {sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null}, + {sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null}, + {null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1}, + {null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1}, + {sMt1, null, null, null, sMt1, null, null, null, null}, + {null, sMt1, null, sMt1, null, null, null, null, null}, + {sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null}, + {null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2} + }; + public static List sSingleNonBlockDamagableRecipeList_validsShapes1 = new ArrayList(44); + public static boolean sSingleNonBlockDamagableRecipeList_validsShapes1_update = false; + public static List sSingleNonBlockDamagableRecipeList_warntOutput = new ArrayList(50); + public static List sVanillaRecipeList_warntOutput = new ArrayList(50); + public static final List sSingleNonBlockDamagableRecipeList_verified = new ArrayList(1000); static { sNativeRecipeClasses.add(ShapedRecipes.class.getName()); @@ -696,7 +752,7 @@ public class GT_ModHandler { public static void stopBufferingCraftingRecipes() { sBufferCraftingRecipes = false; - for (IRecipe tRecipe : sBufferRecipeList) GameRegistry.addRecipe(tRecipe); + for (IRecipe tRecipe : sBufferRecipeList) {GameRegistry.addRecipe(tRecipe);} sBufferRecipeList.clear(); } @@ -1026,11 +1082,11 @@ public class GT_ModHandler { } else if (tObject instanceof String) { tRecipe[i] = GT_OreDictUnificator.getFirstOre(tObject, 1); if (tRecipe[i] == null) break; - } else if (tObject instanceof Boolean) { + }/* else if (tObject instanceof Boolean) { // } else { throw new IllegalArgumentException(); - } + }*/ i++; } removeRecipe(tRecipe); @@ -1260,9 +1316,11 @@ public class GT_ModHandler { * This also removes old Recipes from the List. */ public static ArrayList getVanillyToolRecipeOutputs(ItemStack... aRecipe) { - if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished) - sSingleNonBlockDamagableRecipeList.clear(); - if (sSingleNonBlockDamagableRecipeList.isEmpty()) { + ArrayList rList = new ArrayList(); + if (aRecipe == null) {return rList;} + if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished) { + sSingleNonBlockDamagableRecipeList.clear();sSingleNonBlockDamagableRecipeList_create = true;sSingleNonBlockDamagableRecipeList_validsShapes1.clear();} + if (sSingleNonBlockDamagableRecipeList_create/*sSingleNonBlockDamagableRecipeList.isEmpty()*/) { for (IRecipe tRecipe : (ArrayList) CraftingManager.getInstance().getRecipeList()) { ItemStack tStack = tRecipe.getRecipeOutput(); if (GT_Utility.isStackValid(tStack) && tStack.getMaxStackSize() == 1 && tStack.getMaxDamage() > 0 && !(tStack.getItem() instanceof ItemBlock) && !(tStack.getItem() instanceof IReactorComponent) && !isElectricItem(tStack) && !GT_Utility.isStackInList(tStack, sNonReplaceableItems)) { @@ -1297,10 +1355,29 @@ public class GT_ModHandler { } } GT_Log.out.println("GT_Mod: Created a List of Tool Recipes containing " + sSingleNonBlockDamagableRecipeList.size() + " Recipes for recycling." + (sSingleNonBlockDamagableRecipeList.size() > 1024 ? " Scanning all these Recipes is the reason for the startup Lag you receive right now." : E)); + int aList_move = sSingleNonBlockDamagableRecipeList.size(); + sSingleNonBlockDamagableRecipeList_list.add(aList_move); + sSingleNonBlockDamagableRecipeList_create = false; + sSingleNonBlockDamagableRecipeList_validsShapes1_update = true; + InventoryCrafting aCrafting = new InventoryCrafting(new Container() { + @Override + public boolean canInteractWith(EntityPlayer var1) {return false;}}, 3, 3); + for (int i = 0; i < aList_move; i++) { + for (int j = 0; j < sShapes1.length; j++) { + ItemStack[] sRecipe = sShapes1[j]; + for (int l = 0; l < 9 && l < sRecipe.length; l++) {aCrafting.setInventorySlotContents(l, sRecipe[l]);} + IRecipe vRecipe = sSingleNonBlockDamagableRecipeList.get(i); + if (vRecipe.matches(aCrafting, DW)) { + if (!(sSingleNonBlockDamagableRecipeList_validsShapes1.contains(j))) {sSingleNonBlockDamagableRecipeList_validsShapes1.add(j);} + sSingleNonBlockDamagableRecipeList_verified.add(vRecipe); + } + } + } } - ArrayList rList = getRecipeOutputs(sSingleNonBlockDamagableRecipeList, true, aRecipe); - if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished) - sSingleNonBlockDamagableRecipeList.clear(); + /*ArrayList */ + if (sSingleNonBlockDamagableRecipeList_verified.size() != 0) {rList = getRecipeOutputs(sSingleNonBlockDamagableRecipeList_verified, true, aRecipe);} + if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished) { + sSingleNonBlockDamagableRecipeList.clear();sSingleNonBlockDamagableRecipeList_create = true;sSingleNonBlockDamagableRecipeList_validsShapes1.clear();} return rList; } @@ -1318,7 +1395,7 @@ public class GT_ModHandler { */ public static ArrayList getRecipeOutputs(List aList, boolean aDeleteFromList, ItemStack... aRecipe) { ArrayList rList = new ArrayList(); - if (aRecipe == null) return rList; + if (aRecipe == null || aList.size() == 0) return rList; boolean temp = false; for (byte i = 0; i < aRecipe.length; i++) { if (aRecipe[i] != null) { @@ -1333,24 +1410,44 @@ public class GT_ModHandler { return false; } }, 3, 3); - for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); + for (int i = 0; i < 9 && i < aRecipe.length; i++) {aCrafting.setInventorySlotContents(i, aRecipe[i]);} int aList_sS=aList.size(); - try { - for (int i = 0; i < aList_sS; i++) { - temp = false; - temp = aList.get(i).matches(aCrafting, DW); - if (temp) { - ItemStack tOutput = aList.get(i).getCraftingResult(aCrafting); + ArrayList tempaList_list = new ArrayList(); + if(!aDeleteFromList) { + for (int i = 0; i < aList_sS; i++) { + IRecipe tempALg0 = aList.get(i); + if (tempALg0.matches(aCrafting, DW)) { + ItemStack tOutput = tempALg0.getCraftingResult(aCrafting); + if (tOutput == null || tOutput.stackSize <= 0) { + if (!(sVanillaRecipeList_warntOutput.contains(i))) {sVanillaRecipeList_warntOutput.add(i);} + } else { + rList.add(GT_Utility.copy(tOutput)); + if (aDeleteFromList) {tempaList_list.add(i);} + } + } + } + } else { + for (int i = 0; i < aList_sS; i++) { + IRecipe tempALg0 = aList.get(i); + ItemStack tOutput = tempALg0.getCraftingResult(aCrafting); if (tOutput == null || tOutput.stackSize <= 0) { - // Seriously, who would ever do that shit? - if (!GregTech_API.sPostloadFinished) - throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that."); + if (!(sSingleNonBlockDamagableRecipeList_warntOutput.contains(i))) {sSingleNonBlockDamagableRecipeList_warntOutput.add(i);} } else { rList.add(GT_Utility.copy(tOutput)); - if (aDeleteFromList) aList.remove(i--); aList_sS=aList.size(); + if (aDeleteFromList) {tempaList_list.add(i);} + } } } - }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} + //boolean tempaList_list_b = tempaList_list.size() != 0 ? true : false; + if (aDeleteFromList && tempaList_list.size() != 0) { + List tempaList_2 = new ArrayList(); + for (int i = 0; i < aList_sS; i++) { + int k = 0, l = 0; + if (tempaList_list.get(k) == i) {k++;continue;} + tempaList_2.add(aList.get(l));l++; + } + aList = tempaList_2; + } return rList; } diff --git a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java index 611c8d34e2..27d3aed199 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java +++ b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java @@ -121,6 +121,8 @@ public class GT_RecipeRegistrator { {"Scythe", s_H + s_P + s_I, s_P + s_F + s_R, " " + " " + s_R} }; public static volatile int VERSION = 509; + public static int sRodMaterialList_cycles = 0; + private static int i_count = 0; public static void registerMaterialRecycling(ItemStack aStack, Materials aMaterial, long aMaterialAmount, MaterialStack aByproduct) { if (GT_Utility.isStackInvalid(aStack)) return; @@ -272,7 +274,7 @@ public class GT_RecipeRegistrator { * You give this Function a Material and it will scan almost everything for adding recycling Recipes * * @param aMat a Material, for example an Ingot or a Gem. - * @param aOutput the Dust you usually get from macerating aMat + * @param aPlate the Dust you usually get from macerating aMat * @param aRecipeReplacing allows to replace the Recipe with a Plate variant */ public static synchronized void registerUsagesForMaterials(ItemStack aMat, String aPlate, boolean aRecipeReplacing) { @@ -280,8 +282,11 @@ public class GT_RecipeRegistrator { aMat = GT_Utility.copy(aMat); ItemStack tStack; ItemData aItemData = GT_OreDictUnificator.getItemData(aMat); - if (aItemData == null || aItemData.mPrefix != OrePrefixes.ingot) aPlate = null; + boolean aItemData_b_0 = aItemData != null ? true : false; + if (!aItemData_b_0 || aItemData.mPrefix != OrePrefixes.ingot) {aPlate = null;} if (aPlate != null && GT_OreDictUnificator.getFirstOre(aPlate, 1) == null) aPlate = null; + boolean aItemData_b_1 = aItemData.hasValidPrefixMaterialData() ? true : false; + boolean aPlate_b_0 = aPlate != null ? true : false; sMt1.func_150996_a(aMat.getItem()); sMt1.stackSize = 1; @@ -296,12 +301,13 @@ public class GT_RecipeRegistrator { for (ItemStack tMat : tRecipe) { if (tMat == sMt1) tAmount1++; } - if (aItemData != null && aItemData.hasValidPrefixMaterialData()) + if (aItemData_b_0 && aItemData_b_1) for (ItemStack tCrafted : GT_ModHandler.getRecipeOutputs(tRecipe)) { GT_OreDictUnificator.addItemData(tCrafted, new ItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1)); } } + GT_ModHandler.getVanillyToolRecipeOutputs(sShapes1[0]); for (Materials tMaterial : sRodMaterialList) { ItemStack tMt2 = GT_OreDictUnificator.get(OrePrefixes.stick, tMaterial, 1); if (tMt2 != null) { @@ -309,37 +315,48 @@ public class GT_RecipeRegistrator { sMt2.stackSize = 1; Items.feather.setDamage(sMt2, Items.feather.getDamage(tMt2)); - for (int i = 0; i < sShapes1.length; i++) { - ItemStack[] tRecipe = sShapes1[i]; + if (GT_ModHandler.sSingleNonBlockDamagableRecipeList.size() == 0 || GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1.size() == 0 || GT_ModHandler.sSingleNonBlockDamagableRecipeList_verified.size() == 0) { sRodMaterialList_cycles++;continue;} + int sShapes1_len = GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1.size(); + for (int i = 0; i < sShapes1_len; i++) { + int i2 = GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1.get(i); + ItemStack[] tRecipe = sShapes1[i2]; + if (tRecipe == null) continue; int tAmount1 = 0, tAmount2 = 0; for (ItemStack tMat : tRecipe) { if (tMat == sMt1) tAmount1++; if (tMat == sMt2) tAmount2++; } - for (ItemStack tCrafted : GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe)) { - if (aItemData != null && aItemData.hasValidPrefixMaterialData()) - GT_OreDictUnificator.addItemData(tCrafted, new ItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1, new MaterialStack(tMaterial, OrePrefixes.stick.mMaterialAmount * tAmount2))); - - if (aRecipeReplacing && aPlate != null && sShapesA[i] != null && sShapesA[i].length > 1) { - assert aItemData != null; - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.recipereplacements, aItemData.mMaterial.mMaterial + "." + sShapesA[i][0], true)) { - if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe))) { - switch (sShapesA[i].length) { - case 2: - GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); - break; - case 3: - GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], sShapesA[i][2], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); - break; - default: - GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], sShapesA[i][2], sShapesA[i][3], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); - break; + List tempTest = GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe); + if (GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1_update && GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1.size() != 0) {sShapes1_len = GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1.size();GT_ModHandler.sSingleNonBlockDamagableRecipeList_validsShapes1_update = false;} + int tempTest_size_sS = tempTest.size(); + if (tempTest_size_sS > 0) { + for (ItemStack tCrafted : tempTest/*GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe)*/) { + if (aItemData_b_0 && aItemData_b_1) { + GT_OreDictUnificator.addItemData(tCrafted, new ItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1, new MaterialStack(tMaterial, OrePrefixes.stick.mMaterialAmount * tAmount2))); + } + + if (aRecipeReplacing && aPlate_b_0 && sShapesA[i2] != null && sShapesA[i2].length > 1) { + //assert aItemData != null;//dead dev code or decomp JAD? + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.recipereplacements, new StringBuilder().append(aItemData.mMaterial.mMaterial).append('.').append(sShapesA[i2][0]).toString(), true)) { + if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe))) { + switch (sShapesA[i].length) { + case 2: + GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i2][1], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); + break; + case 3: + GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i2][1], sShapesA[i2][2], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); + break; + default: + GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i2][1], sShapesA[i2][2], sShapesA[i2][3], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); + break; + } } } } } } + sRodMaterialList_cycles++; } } } -- cgit From c6bc630efc75ab75fd46dbdc26dc89e2ce92d6ee Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sat, 13 Aug 2016 05:16:04 +0100 Subject: Rest of previous commit --- src/main/java/gregtech/GT_Mod.java | 2 +- src/main/java/gregtech/api/util/GT_ModHandler.java | 49 +++++++++++----------- .../gregtech/common/blocks/GT_TileEntity_Ores.java | 4 ++ .../loaders/oreprocessing/ProcessingGem.java | 39 +++++++++-------- .../loaders/oreprocessing/ProcessingIngot1.java | 47 +++++++++++---------- 5 files changed, 77 insertions(+), 64 deletions(-) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 5e6136b8a8..9d155df387 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -62,7 +62,7 @@ import java.util.Map.Entry; //import forestry.factory.tiles.TileSqueezer; -@Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl;") +@Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl; after:UndergroundBiomes;") public class GT_Mod implements IGT_Mod { public static final int VERSION = 509; diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index a8c9eeea3a..b22650df0d 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -1324,33 +1324,32 @@ public class GT_ModHandler { for (IRecipe tRecipe : (ArrayList) CraftingManager.getInstance().getRecipeList()) { ItemStack tStack = tRecipe.getRecipeOutput(); if (GT_Utility.isStackValid(tStack) && tStack.getMaxStackSize() == 1 && tStack.getMaxDamage() > 0 && !(tStack.getItem() instanceof ItemBlock) && !(tStack.getItem() instanceof IReactorComponent) && !isElectricItem(tStack) && !GT_Utility.isStackInList(tStack, sNonReplaceableItems)) { - if (!(tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) { - if (tRecipe instanceof ShapedOreRecipe) { - boolean temp = true; - for (Object tObject : ((ShapedOreRecipe) tRecipe).getInput()) - if (tObject != null) { - if (tObject instanceof ItemStack && (((ItemStack) tObject).getItem() == null || ((ItemStack) tObject).getMaxStackSize() < 2 || ((ItemStack) tObject).getMaxDamage() > 0 || ((ItemStack) tObject).getItem() instanceof ItemBlock)) { - temp = false; - break; - } - if (tObject instanceof List && ((List) tObject).isEmpty()) { - temp = false; - break; - } + if (tRecipe instanceof ShapedOreRecipe) { + boolean temp = true; + for (Object tObject : ((ShapedOreRecipe) tRecipe).getInput()) { + if (tObject != null) { + if (tObject instanceof ItemStack && (((ItemStack) tObject).getItem() == null || ((ItemStack) tObject).getMaxStackSize() < 2 || ((ItemStack) tObject).getMaxDamage() > 0 || ((ItemStack) tObject).getItem() instanceof ItemBlock)) { + temp = false; + break; } - if (temp) sSingleNonBlockDamagableRecipeList.add(tRecipe); - } else if (tRecipe instanceof ShapedRecipes) { - boolean temp = true; - for (ItemStack tObject : ((ShapedRecipes) tRecipe).recipeItems) { - if (tObject != null && (tObject.getItem() == null || tObject.getMaxStackSize() < 2 || tObject.getMaxDamage() > 0 || tObject.getItem() instanceof ItemBlock)) { + if (tObject instanceof List && ((List) tObject).isEmpty()) { temp = false; break; } } - if (temp) sSingleNonBlockDamagableRecipeList.add(tRecipe); - } else { - sSingleNonBlockDamagableRecipeList.add(tRecipe); } + if (temp) {sSingleNonBlockDamagableRecipeList.add(tRecipe);} + } else if (tRecipe instanceof ShapedRecipes) { + boolean temp = true; + for (ItemStack tObject : ((ShapedRecipes) tRecipe).recipeItems) { + if (tObject != null && (tObject.getItem() == null || tObject.getMaxStackSize() < 2 || tObject.getMaxDamage() > 0 || tObject.getItem() instanceof ItemBlock)) { + temp = false; + break; + } + } + if (temp) {sSingleNonBlockDamagableRecipeList.add(tRecipe);} + } else { + sSingleNonBlockDamagableRecipeList.add(tRecipe); } } } @@ -1360,8 +1359,8 @@ public class GT_ModHandler { sSingleNonBlockDamagableRecipeList_create = false; sSingleNonBlockDamagableRecipeList_validsShapes1_update = true; InventoryCrafting aCrafting = new InventoryCrafting(new Container() { - @Override - public boolean canInteractWith(EntityPlayer var1) {return false;}}, 3, 3); + @Override + public boolean canInteractWith(EntityPlayer var1) {return false;}}, 3, 3); for (int i = 0; i < aList_move; i++) { for (int j = 0; j < sShapes1.length; j++) { ItemStack[] sRecipe = sShapes1[j]; @@ -1395,7 +1394,7 @@ public class GT_ModHandler { */ public static ArrayList getRecipeOutputs(List aList, boolean aDeleteFromList, ItemStack... aRecipe) { ArrayList rList = new ArrayList(); - if (aRecipe == null || aList.size() == 0) return rList; + if (aRecipe == null || aList.size() == 0) {return rList;} boolean temp = false; for (byte i = 0; i < aRecipe.length; i++) { if (aRecipe[i] != null) { @@ -1403,7 +1402,7 @@ public class GT_ModHandler { break; } } - if (!temp) return rList; + if (!temp) {return rList;} InventoryCrafting aCrafting = new InventoryCrafting(new Container() { @Override public boolean canInteractWith(EntityPlayer var1) { diff --git a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java index 1913c34378..14e77ac748 100644 --- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java @@ -55,16 +55,19 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit if (GregTech_API.sBlockOresUb1 != null) { tOreBlock = GregTech_API.sBlockOresUb1; aMetaData += (BlockMeta * 1000); + //System.out.println("Block changed to UB1"); } } else if (BlockName.equals("tile.metamorphicStone")) { if (GregTech_API.sBlockOresUb2 != null) { tOreBlock = GregTech_API.sBlockOresUb2; aMetaData += (BlockMeta * 1000); + //System.out.println("Block changed to UB2"); } } else if (BlockName.equals("tile.sedimentaryStone")) { if (GregTech_API.sBlockOresUb3 != null) { tOreBlock = GregTech_API.sBlockOresUb3; aMetaData += (BlockMeta * 1000); + //System.out.println("Block changed to UB3"); } } else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) { aMetaData += 1000; @@ -93,6 +96,7 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit } else if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) { return false; } + System.out.println(tOreBlock); aWorld.setBlock(aX, aY, aZ, tOreBlock, getHarvestData((short) aMetaData), 0); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if ((tTileEntity instanceof GT_TileEntity_Ores)) { diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingGem.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingGem.java index c2e28e969d..1933c2d12c 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingGem.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingGem.java @@ -12,41 +12,46 @@ public class ProcessingGem implements gregtech.api.interfaces.IOreRecipeRegistra } public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { + Object[] Ogem0 = new Object[]{aStack}; if (aMaterial.mFuelPower > 0) { - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, aMaterial.mFuelPower * 2, aMaterial.mFuelType); + GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, Ogem0), null, aMaterial.mFuelPower * 2, aMaterial.mFuelType); } - GT_Values.RA.addBoxingRecipe(GT_Utility.copyAmount(16L, new Object[]{aStack}), ItemList.Crate_Empty.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.crateGtGem, aMaterial, 1L), 100, 8); + GT_Values.RA.addBoxingRecipe(GT_Utility.copyAmount(16L, Ogem0), ItemList.Crate_Empty.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.crateGtGem, aMaterial, 1L), 100, 8); GT_Values.RA.addUnboxingRecipe(GT_OreDictUnificator.get(OrePrefixes.crateGtGem, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 16L), ItemList.Crate_Empty.get(1L, new Object[0]), 800, 1); - if (!OrePrefixes.block.isIgnored(aMaterial)) - GT_ModHandler.addCompressionRecipe(GT_Utility.copyAmount(9L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L)); + if (!OrePrefixes.block.isIgnored(aMaterial)) { + GT_ModHandler.addCompressionRecipe(GT_Utility.copyAmount(9L, Ogem0), GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L)); + } if (!aMaterial.contains(SubTag.NO_SMELTING)) { - GT_ModHandler.addSmeltingRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial.mSmeltInto, 1L)); + GT_ModHandler.addSmeltingRecipe(GT_Utility.copyAmount(1L, Ogem0), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial.mSmeltInto, 1L)); } - if (aMaterial.contains(SubTag.NO_SMASHING)) { + boolean BmatNSs0 = aMaterial.contains(SubTag.NO_SMASHING); + if (BmatNSs0) { GT_Values.RA.addForgeHammerRecipe(aStack, GT_OreDictUnificator.get(OrePrefixes.gemFlawed, aMaterial, 2L), 64, 16); } else { - GT_Values.RA.addForgeHammerRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(aMaterial.getMass(), 1L), 16); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 2L, 1L), 24); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateDouble, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 2L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateTriple, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 3L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(4L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 4L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(5L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuintuple, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 5L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(9L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 9L, 1L), 96); + long matgM0 = aMaterial.getMass(); + GT_Values.RA.addForgeHammerRecipe(GT_Utility.copyAmount(1L, Ogem0), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(matgM0, 1L), 16); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, Ogem0), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(matgM0 * 2L, 1L), 24); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, Ogem0), GT_OreDictUnificator.get(OrePrefixes.plateDouble, aMaterial, 1L), (int) Math.max(matgM0 * 2L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, Ogem0), GT_OreDictUnificator.get(OrePrefixes.plateTriple, aMaterial, 1L), (int) Math.max(matgM0 * 3L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(4L, Ogem0), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(matgM0 * 4L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(5L, Ogem0), GT_OreDictUnificator.get(OrePrefixes.plateQuintuple, aMaterial, 1L), (int) Math.max(matgM0 * 5L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(9L, Ogem0), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(matgM0 * 9L, 1L), 96); } if (!aMaterial.contains(SubTag.NO_WORKING)) { - GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 2L), (int) Math.max(aMaterial.getMass(), 1L), 16); + long matgM0 = aMaterial.getMass(); + GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, Ogem0), GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 2L), (int) Math.max(matgM0, 1L), 16); } - gregtech.api.util.GT_RecipeRegistrator.registerUsagesForMaterials(GT_Utility.copyAmount(1L, new Object[]{aStack}), OrePrefixes.plate.get(aMaterial).toString(), !aMaterial.contains(SubTag.NO_SMASHING)); + gregtech.api.util.GT_RecipeRegistrator.registerUsagesForMaterials(GT_Utility.copyAmount(1L, Ogem0), OrePrefixes.plate.get(aMaterial).toString(), !BmatNSs0); switch (aMaterial) { case _NULL: break; case Coal: case Charcoal: - if (gregtech.api.GregTech_API.sRecipeFile.get(gregtech.api.enums.ConfigCategories.Recipes.disabledrecipes, "torchesFromCoal", false)) - GT_ModHandler.removeRecipe(new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{aStack}), null, null, new ItemStack(net.minecraft.init.Items.stick, 1, 0)}); + if (gregtech.api.GregTech_API.sRecipeFile.get(gregtech.api.enums.ConfigCategories.Recipes.disabledrecipes, "torchesFromCoal", false)) { + GT_ModHandler.removeRecipe(new ItemStack[]{GT_Utility.copyAmount(1L, Ogem0), null, null, new ItemStack(net.minecraft.init.Items.stick, 1, 0)});} break; case CertusQuartz: GT_Values.RA.addElectrolyzerRecipe(aStack, 0, GT_ModHandler.getModItem("appliedenergistics2", "item.ItemMultiMaterial", 1L, 1), null, null, null, null, null, 2000, 30); diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingIngot1.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingIngot1.java index 3a76885e2b..5193ab4479 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingIngot1.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingIngot1.java @@ -13,39 +13,44 @@ public class ProcessingIngot1 implements gregtech.api.interfaces.IOreRecipeRegis } public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { + Object[] Ogem1 = new Object[]{aStack}; if (aMaterial.mFuelPower > 0) { - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, aMaterial.mFuelPower, aMaterial.mFuelType); + GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, Ogem1), null, aMaterial.mFuelPower, aMaterial.mFuelType); } - GT_Values.RA.addBoxingRecipe(GT_Utility.copyAmount(16L, new Object[]{aStack}), ItemList.Crate_Empty.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, aMaterial, 1L), 100, 8); + GT_Values.RA.addBoxingRecipe(GT_Utility.copyAmount(16L, Ogem1), ItemList.Crate_Empty.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, aMaterial, 1L), 100, 8); GT_Values.RA.addUnboxingRecipe(GT_OreDictUnificator.get(OrePrefixes.crateGtIngot, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 16L), ItemList.Crate_Empty.get(1L, new Object[0]), 800, 1); - if (aMaterial.mStandardMoltenFluid != null) + if (aMaterial.mStandardMoltenFluid != null) { GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0L, new Object[0]), aMaterial.getMolten(144L), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), 32, 8); + } GT_RecipeRegistrator.registerReverseFluidSmelting(aStack, aMaterial, aPrefix.mMaterialAmount, null); GT_RecipeRegistrator.registerReverseMacerating(aStack, aMaterial, aPrefix.mMaterialAmount, null, null, null, false); if (aMaterial.mSmeltInto.mArcSmeltInto != aMaterial) { - GT_RecipeRegistrator.registerReverseArcSmelting(GT_Utility.copyAmount(1L, new Object[]{aStack}), aMaterial, aPrefix.mMaterialAmount, null, null, null); + GT_RecipeRegistrator.registerReverseArcSmelting(GT_Utility.copyAmount(1L, Ogem1), aMaterial, aPrefix.mMaterialAmount, null, null, null); } - if (!aMaterial.contains(SubTag.NO_SMASHING)) { - GT_Values.RA.addWiremillRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_Utility.copy(new Object[]{GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, aMaterial, 8L)}), 100, 4); - GT_Values.RA.addForgeHammerRecipe(GT_Utility.copyAmount(2L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(aMaterial.getMass(), 1L), 16); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 1L, 1L), 24); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateDouble, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 2L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateTriple, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 3L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(4L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 4L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(5L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuintuple, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 5L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(9L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(aMaterial.getMass() * 9L, 1L), 96); + boolean BmatNSs1 = aMaterial.contains(SubTag.NO_SMASHING); + if (!BmatNSs1) { + long matgM1 = aMaterial.getMass(); + GT_Values.RA.addWiremillRecipe(GT_Utility.copyAmount(1L, Ogem1), GT_Utility.copy(new Object[]{GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, aMaterial, 8L)}), 100, 4); + GT_Values.RA.addForgeHammerRecipe(GT_Utility.copyAmount(2L, Ogem1), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(matgM1, 1L), 16); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, Ogem1), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(matgM1 * 1L, 1L), 24); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, Ogem1), GT_OreDictUnificator.get(OrePrefixes.plateDouble, aMaterial, 1L), (int) Math.max(matgM1 * 2L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, Ogem1), GT_OreDictUnificator.get(OrePrefixes.plateTriple, aMaterial, 1L), (int) Math.max(matgM1 * 3L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(4L, Ogem1), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(matgM1 * 4L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(5L, Ogem1), GT_OreDictUnificator.get(OrePrefixes.plateQuintuple, aMaterial, 1L), (int) Math.max(matgM1 * 5L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(9L, Ogem1), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(matgM1 * 9L, 1L), 96); } GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.round, aMaterial, 9L), null, (int) Math.max(aMaterial.getMass() / 4L, 1L), 8); - if (!OrePrefixes.block.isIgnored(aMaterial)) - GT_ModHandler.addCompressionRecipe(GT_Utility.copyAmount(9L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L)); - if (!aMaterial.contains(SubTag.NO_WORKING)) - GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial.mMacerateInto, 2L), (int) Math.max(aMaterial.getMass() * 5L, 1L), 16); + if (!OrePrefixes.block.isIgnored(aMaterial)) { + GT_ModHandler.addCompressionRecipe(GT_Utility.copyAmount(9L, Ogem1), GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L));} + if (!aMaterial.contains(SubTag.NO_WORKING)) { + long matgM1 = aMaterial.getMass(); + GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, Ogem1), GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial.mMacerateInto, 2L), (int) Math.max(matgM1 * 5L, 1L), 16);} if (!aMaterial.contains(SubTag.NO_SMELTING)) { - GT_Values.RA.addAlloySmelterRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), ItemList.Shape_Mold_Nugget.get(0L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.nugget, aMaterial, 9L), 100, 1); - if ((GT_ModHandler.getSmeltingOutput(aStack, false, null) == null) && (GT_OreDictUnificator.get(OrePrefixes.nugget, aMaterial.mSmeltInto, 1L) != null) && (!GT_ModHandler.addSmeltingRecipe(aStack, GT_OreDictUnificator.get(OrePrefixes.nugget, aMaterial.mSmeltInto, 9L)))) - GT_ModHandler.addShapelessCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.nugget, aMaterial.mSmeltInto, 9L), new Object[]{aOreDictName}); + GT_Values.RA.addAlloySmelterRecipe(GT_Utility.copyAmount(1L, Ogem1), ItemList.Shape_Mold_Nugget.get(0L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.nugget, aMaterial, 9L), 100, 1); + if ((GT_ModHandler.getSmeltingOutput(aStack, false, null) == null) && (GT_OreDictUnificator.get(OrePrefixes.nugget, aMaterial.mSmeltInto, 1L) != null) && (!GT_ModHandler.addSmeltingRecipe(aStack, GT_OreDictUnificator.get(OrePrefixes.nugget, aMaterial.mSmeltInto, 9L)))) { + GT_ModHandler.addShapelessCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.nugget, aMaterial.mSmeltInto, 9L), new Object[]{aOreDictName});} } ItemStack tStack; if ((null != (tStack = GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial.mMacerateInto, 1L))) && ( @@ -53,7 +58,7 @@ public class ProcessingIngot1 implements gregtech.api.interfaces.IOreRecipeRegis GT_ModHandler.removeFurnaceSmelting(tStack); } - GT_RecipeRegistrator.registerUsagesForMaterials(GT_Utility.copyAmount(1L, new Object[]{aStack}), OrePrefixes.plate.get(aMaterial).toString(), !aMaterial.contains(SubTag.NO_SMASHING)); + GT_RecipeRegistrator.registerUsagesForMaterials(GT_Utility.copyAmount(1L, Ogem1), OrePrefixes.plate.get(aMaterial).toString(), !BmatNSs1); if (aMaterial == Materials.Mercury) { System.err.println("Quicksilver Ingots?, Don't tell me there is an Armor made of that highly toxic and very likely to be melting Material!"); -- cgit From 789199a57823442dde1f91a1764cbc7e7dedade8 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sat, 13 Aug 2016 08:28:24 +0100 Subject: Concurrent Hash maps and string vars --- src/main/java/gregtech/GT_Mod.java | 119 +++++------ src/main/java/gregtech/api/GregTech_API.java | 17 +- .../gregtech/api/items/GT_EnergyArmor_Item.java | 4 +- .../java/gregtech/api/items/GT_MetaBase_Item.java | 4 +- .../gregtech/api/items/GT_MetaGenerated_Item.java | 11 +- .../gregtech/api/items/GT_MetaGenerated_Tool.java | 8 +- .../implementations/GT_MetaPipeEntity_Fluid.java | 4 +- .../implementations/GT_MetaPipeEntity_Item.java | 4 +- .../api/objects/GT_CopiedBlockTexture.java | 2 +- .../java/gregtech/api/objects/GT_FluidStack.java | 4 +- src/main/java/gregtech/api/objects/GT_HashSet.java | 12 +- .../java/gregtech/api/objects/GT_ItemStack.java | 6 +- src/main/java/gregtech/api/objects/ItemData.java | 10 +- src/main/java/gregtech/api/util/GT_ModHandler.java | 16 +- .../gregtech/api/util/GT_OreDictUnificator.java | 5 +- src/main/java/gregtech/api/util/GT_Recipe.java | 4 +- src/main/java/gregtech/api/util/GT_Utility.java | 13 +- src/main/java/gregtech/api/world/GT_Worldgen.java | 4 +- .../java/gregtech/api/world/GT_Worldgen_Ore.java | 11 +- src/main/java/gregtech/common/GT_Proxy.java | 235 +++++++++++---------- .../gregtech/common/GT_Worldgen_GT_Ore_Layer.java | 29 +-- .../common/GT_Worldgen_GT_Ore_SmallPieces.java | 18 +- .../common/blocks/GT_Block_Ores_Abstract.java | 86 ++++---- .../items/behaviors/Behaviour_Plunger_Item.java | 4 +- .../gregtech/loaders/misc/GT_Achievements.java | 10 +- 25 files changed, 326 insertions(+), 314 deletions(-) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 9d155df387..576ba97658 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -57,11 +57,6 @@ import java.io.PrintStream; import java.util.*; import java.util.Map.Entry; -//import forestry.factory.recipes.ISqueezerRecipe; -//import forestry.factory.tiles.TileCentrifuge; -//import forestry.factory.tiles.TileSqueezer; - - @Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl; after:UndergroundBiomes;") public class GT_Mod implements IGT_Mod { @@ -73,12 +68,14 @@ public class GT_Mod public static GT_Proxy gregtechproxy; public static int MAX_IC2 = 2147483647; public static GT_Achievements achievements; + private final String aTextGeneral = "general"; + private final String aTextIC2 = "ic2_"; - static { + /*static { if ((509 != GregTech_API.VERSION) || (509 != GT_ModHandler.VERSION) || (509 != GT_OreDictUnificator.VERSION) || (509 != GT_Recipe.VERSION) || (509 != GT_Utility.VERSION) || (509 != GT_RecipeRegistrator.VERSION) || (509 != Element.VERSION) || (509 != Materials.VERSION) || (509 != OrePrefixes.VERSION)) { throw new GT_ItsNotMyFaultException("One of your Mods included GregTech-API Files inside it's download, mention this to the Mod Author, who does this bad thing, and tell him/her to use reflection. I have added a Version check, to prevent Authors from breaking my Mod that way."); } - } + }*/ public GT_Mod() { try { @@ -149,7 +146,7 @@ public class GT_Mod } catch (Throwable e) { } } - if (tMainConfig.get("general", "LoggingPlayerActivity", true).getBoolean(true)) { + if (tMainConfig.get(aTextGeneral, "LoggingPlayerActivity", true).getBoolean(true)) { GT_Log.mPlayerActivityLogFile = new File(aEvent.getModConfigurationDirectory().getParentFile(), "logs/PlayerActivity.log"); if (!GT_Log.mPlayerActivityLogFile.exists()) { try { @@ -179,15 +176,15 @@ public class GT_Mod gregtechproxy.onPreLoad(); GT_Log.out.println("GT_Mod: Setting Configs"); - GT_Values.D1 = tMainConfig.get("general", "Debug", false).getBoolean(false); - GT_Values.D2 = tMainConfig.get("general", "Debug2", false).getBoolean(false); + GT_Values.D1 = tMainConfig.get(aTextGeneral, "Debug", false).getBoolean(false); + GT_Values.D2 = tMainConfig.get(aTextGeneral, "Debug2", false).getBoolean(false); - GregTech_API.TICKS_FOR_LAG_AVERAGING = tMainConfig.get("general", "TicksForLagAveragingWithScanner", 25).getInt(25); - GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = tMainConfig.get("general", "MillisecondsPassedInGTTileEntityUntilLagWarning", 100).getInt(100); - if (tMainConfig.get("general", "disable_STDOUT", false).getBoolean(false)) { + GregTech_API.TICKS_FOR_LAG_AVERAGING = tMainConfig.get(aTextGeneral, "TicksForLagAveragingWithScanner", 25).getInt(25); + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = tMainConfig.get(aTextGeneral, "MillisecondsPassedInGTTileEntityUntilLagWarning", 100).getInt(100); + if (tMainConfig.get(aTextGeneral, "disable_STDOUT", false).getBoolean(false)) { System.out.close(); } - if (tMainConfig.get("general", "disable_STDERR", false).getBoolean(false)) { + if (tMainConfig.get(aTextGeneral, "disable_STDERR", false).getBoolean(false)) { System.err.close(); } GregTech_API.sMachineExplosions = tMainConfig.get("machines", "machines_explosion_damage", true).getBoolean(false); @@ -200,10 +197,10 @@ public class GT_Mod GregTech_API.sConstantEnergy = tMainConfig.get("machines", "constant_need_of_energy", true).getBoolean(false); GregTech_API.sColoredGUI = tMainConfig.get("machines", "colored_guis_when_painted", true).getBoolean(false); - GregTech_API.sTimber = tMainConfig.get("general", "timber_axe", false).getBoolean(false); - GregTech_API.sDrinksAlwaysDrinkable = tMainConfig.get("general", "drinks_always_drinkable", false).getBoolean(false); - GregTech_API.sDoShowAllItemsInCreative = tMainConfig.get("general", "show_all_metaitems_in_creative_and_NEI", false).getBoolean(false); - GregTech_API.sMultiThreadedSounds = tMainConfig.get("general", "sound_multi_threading", false).getBoolean(false); + GregTech_API.sTimber = tMainConfig.get(aTextGeneral, "timber_axe", false).getBoolean(false); + GregTech_API.sDrinksAlwaysDrinkable = tMainConfig.get(aTextGeneral, "drinks_always_drinkable", false).getBoolean(false); + GregTech_API.sDoShowAllItemsInCreative = tMainConfig.get(aTextGeneral, "show_all_metaitems_in_creative_and_NEI", false).getBoolean(false); + GregTech_API.sMultiThreadedSounds = tMainConfig.get(aTextGeneral, "sound_multi_threading", false).getBoolean(false); for (Dyes tDye : Dyes.values()) { if ((tDye != Dyes._NULL) && (tDye.mIndex < 0)) { tDye.mRGBa[0] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get("ColorModulation." + tDye, "R", tDye.mRGBa[0])))); @@ -211,30 +208,30 @@ public class GT_Mod tDye.mRGBa[2] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get("ColorModulation." + tDye, "B", tDye.mRGBa[2])))); } } - gregtechproxy.mMaxEqualEntitiesAtOneSpot = tMainConfig.get("general", "MaxEqualEntitiesAtOneSpot", 3).getInt(3); - gregtechproxy.mSkeletonsShootGTArrows = tMainConfig.get("general", "SkeletonsShootGTArrows", 16).getInt(16); - gregtechproxy.mFlintChance = tMainConfig.get("general", "FlintAndSteelChance", 30).getInt(30); - gregtechproxy.mItemDespawnTime = tMainConfig.get("general", "ItemDespawnTime", 6000).getInt(6000); - gregtechproxy.mDisableVanillaOres = tMainConfig.get("general", "DisableVanillaOres", true).getBoolean(true); - gregtechproxy.mNerfDustCrafting = tMainConfig.get("general", "NerfDustCrafting", true).getBoolean(true); - gregtechproxy.mIncreaseDungeonLoot = tMainConfig.get("general", "IncreaseDungeonLoot", true).getBoolean(true); - gregtechproxy.mAxeWhenAdventure = tMainConfig.get("general", "AdventureModeStartingAxe", true).getBoolean(true); - gregtechproxy.mHardcoreCables = tMainConfig.get("general", "HardCoreCableLoss", false).getBoolean(false); - gregtechproxy.mSurvivalIntoAdventure = tMainConfig.get("general", "forceAdventureMode", false).getBoolean(false); - gregtechproxy.mHungerEffect = tMainConfig.get("general", "AFK_Hunger", false).getBoolean(false); - gregtechproxy.mHardRock = tMainConfig.get("general", "harderstone", false).getBoolean(false); - gregtechproxy.mInventoryUnification = tMainConfig.get("general", "InventoryUnification", true).getBoolean(true); - gregtechproxy.mGTBees = tMainConfig.get("general", "GTBees", true).getBoolean(true); - gregtechproxy.mCraftingUnification = tMainConfig.get("general", "CraftingUnification", true).getBoolean(true); - gregtechproxy.mNerfedWoodPlank = tMainConfig.get("general", "WoodNeedsSawForCrafting", true).getBoolean(true); - gregtechproxy.mNerfedVanillaTools = tMainConfig.get("general", "smallerVanillaToolDurability", true).getBoolean(true); - gregtechproxy.mSortToTheEnd = tMainConfig.get("general", "EnsureToBeLoadedLast", true).getBoolean(true); - gregtechproxy.mDisableIC2Cables = tMainConfig.get("general", "DisableIC2Cables", true).getBoolean(true); - gregtechproxy.mAchievements = tMainConfig.get("general", "EnableAchievements", true).getBoolean(true); + gregtechproxy.mMaxEqualEntitiesAtOneSpot = tMainConfig.get(aTextGeneral, "MaxEqualEntitiesAtOneSpot", 3).getInt(3); + gregtechproxy.mSkeletonsShootGTArrows = tMainConfig.get(aTextGeneral, "SkeletonsShootGTArrows", 16).getInt(16); + gregtechproxy.mFlintChance = tMainConfig.get(aTextGeneral, "FlintAndSteelChance", 30).getInt(30); + gregtechproxy.mItemDespawnTime = tMainConfig.get(aTextGeneral, "ItemDespawnTime", 6000).getInt(6000); + gregtechproxy.mDisableVanillaOres = tMainConfig.get(aTextGeneral, "DisableVanillaOres", true).getBoolean(true); + gregtechproxy.mNerfDustCrafting = tMainConfig.get(aTextGeneral, "NerfDustCrafting", true).getBoolean(true); + gregtechproxy.mIncreaseDungeonLoot = tMainConfig.get(aTextGeneral, "IncreaseDungeonLoot", true).getBoolean(true); + gregtechproxy.mAxeWhenAdventure = tMainConfig.get(aTextGeneral, "AdventureModeStartingAxe", true).getBoolean(true); + gregtechproxy.mHardcoreCables = tMainConfig.get(aTextGeneral, "HardCoreCableLoss", false).getBoolean(false); + gregtechproxy.mSurvivalIntoAdventure = tMainConfig.get(aTextGeneral, "forceAdventureMode", false).getBoolean(false); + gregtechproxy.mHungerEffect = tMainConfig.get(aTextGeneral, "AFK_Hunger", false).getBoolean(false); + gregtechproxy.mHardRock = tMainConfig.get(aTextGeneral, "harderstone", false).getBoolean(false); + gregtechproxy.mInventoryUnification = tMainConfig.get(aTextGeneral, "InventoryUnification", true).getBoolean(true); + gregtechproxy.mGTBees = tMainConfig.get(aTextGeneral, "GTBees", true).getBoolean(true); + gregtechproxy.mCraftingUnification = tMainConfig.get(aTextGeneral, "CraftingUnification", true).getBoolean(true); + gregtechproxy.mNerfedWoodPlank = tMainConfig.get(aTextGeneral, "WoodNeedsSawForCrafting", true).getBoolean(true); + gregtechproxy.mNerfedVanillaTools = tMainConfig.get(aTextGeneral, "smallerVanillaToolDurability", true).getBoolean(true); + gregtechproxy.mSortToTheEnd = tMainConfig.get(aTextGeneral, "EnsureToBeLoadedLast", true).getBoolean(true); + gregtechproxy.mDisableIC2Cables = tMainConfig.get(aTextGeneral, "DisableIC2Cables", true).getBoolean(true); + gregtechproxy.mAchievements = tMainConfig.get(aTextGeneral, "EnableAchievements", true).getBoolean(true); gregtechproxy.mAE2Integration = GregTech_API.sSpecialFile.get(ConfigCategories.general, "EnableAE2Integration", Loader.isModLoaded("appliedenergistics2")); - gregtechproxy.mNerfedCombs = tMainConfig.get("general", "NerfCombs", true).getBoolean(true); - gregtechproxy.mHideUnusedOres = tMainConfig.get("general", "HideUnusedOres", true).getBoolean(true); - gregtechproxy.mHideRecyclingRecipes = tMainConfig.get("general", "HideRecyclingRecipes", true).getBoolean(true); + gregtechproxy.mNerfedCombs = tMainConfig.get(aTextGeneral, "NerfCombs", true).getBoolean(true); + gregtechproxy.mHideUnusedOres = tMainConfig.get(aTextGeneral, "HideUnusedOres", true).getBoolean(true); + gregtechproxy.mHideRecyclingRecipes = tMainConfig.get(aTextGeneral, "HideRecyclingRecipes", true).getBoolean(true); GregTech_API.mOutputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "OutputRF", true); GregTech_API.mInputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "InputRF", false); @@ -253,10 +250,10 @@ public class GT_Mod } }} - if (tMainConfig.get("general", "hardermobspawners", true).getBoolean(true)) { + if (tMainConfig.get(aTextGeneral, "hardermobspawners", true).getBoolean(true)) { Blocks.mob_spawner.setHardness(500.0F).setResistance(6000000.0F); } - gregtechproxy.mOnline = tMainConfig.get("general", "online", true).getBoolean(false); + gregtechproxy.mOnline = tMainConfig.get(aTextGeneral, "online", true).getBoolean(false); gregtechproxy.mUpgradeCount = Math.min(64, Math.max(1, tMainConfig.get("features", "UpgradeStacksize", 4).getInt())); for (OrePrefixes tPrefix : OrePrefixes.values()) { @@ -514,58 +511,58 @@ public class GT_Mod } } String tName = ""; - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "blastfurnace"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "blastfurnace"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "blockcutter"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "blockcutter"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "inductionFurnace"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "inductionFurnace"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "generator"), false)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "generator"), false)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "windMill"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "windMill"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "waterMill"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "waterMill"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "solarPanel"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "solarPanel"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "centrifuge"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "centrifuge"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "electrolyzer"), false)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "electrolyzer"), false)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "compressor"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "compressor"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "electroFurnace"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "electroFurnace"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "extractor"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "extractor"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "macerator"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "macerator"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "recycler"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "recycler"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "metalformer"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "metalformer"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "orewashingplant"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "orewashingplant"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "massFabricator"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "massFabricator"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "ic2_" + (tName = "replicator"), true)) { + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "replicator"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); } if (gregtechproxy.mNerfedVanillaTools) { diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java index d14b1d0773..1f211be99c 100644 --- a/src/main/java/gregtech/api/GregTech_API.java +++ b/src/main/java/gregtech/api/GregTech_API.java @@ -29,6 +29,7 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import static gregtech.api.enums.GT_Values.*; @@ -92,35 +93,35 @@ public class GregTech_API { /** * The Icon List for Covers */ - public static final Map sCovers = new HashMap(); + public static final Map sCovers = new ConcurrentHashMap(); /** * The List of Cover Behaviors for the Covers */ - public static final Map sCoverBehaviors = new HashMap(); + public static final Map sCoverBehaviors = new ConcurrentHashMap(); /** * The List of Circuit Behaviors for the Redstone Circuit Block */ - public static final Map sCircuitryBehaviors = new HashMap(); + public static final Map sCircuitryBehaviors = new ConcurrentHashMap(); /** * The List of Blocks, which can conduct Machine Block Updates */ - public static final Map sMachineIDs = new HashMap(); + public static final Map sMachineIDs = new ConcurrentHashMap(); /** * The Redstone Frequencies */ - public static final Map sWirelessRedstone = new HashMap(); + public static final Map sWirelessRedstone = new ConcurrentHashMap(); /** * The IDSU Frequencies */ - public static final Map sIDSUList = new HashMap(); + public static final Map sIDSUList = new ConcurrentHashMap(); /** * A List of all Books, which were created using @GT_Utility.getWrittenBook the original Title is the Key Value */ - public static final Map sBookList = new HashMap(); + public static final Map sBookList = new ConcurrentHashMap(); /** * The List of all Sounds used in GT, indices are in the static Block at the bottom */ - public static final Map sSoundList = new HashMap(); + public static final Map sSoundList = new ConcurrentHashMap(); /** * The List of Tools, which can be used. Accepts regular damageable Items and Electric Items */ diff --git a/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java b/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java index 6e3c6df6e1..9ad6deb636 100644 --- a/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java +++ b/src/main/java/gregtech/api/items/GT_EnergyArmor_Item.java @@ -23,14 +23,14 @@ import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingFallEvent; -import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import static gregtech.api.enums.GT_Values.RES_PATH_ITEM; public class GT_EnergyArmor_Item extends ItemArmor implements ISpecialArmor { - public static Map jumpChargeMap = new HashMap(); + public static Map jumpChargeMap = new ConcurrentHashMap(); public int mCharge, mTransfer, mTier, mDamageEnergyCost, mSpecials; public boolean mChargeProvider; public double mArmorAbsorbtionPercentage; diff --git a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java index 98ccf8554b..c34f1a9c0c 100644 --- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java @@ -25,15 +25,15 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; +import java.util.concurrent.ConcurrentHashMap; import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.GT_Values.V; public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem { /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - private final HashMap>> mItemBehaviors = new HashMap>>(); + private final ConcurrentHashMap>> mItemBehaviors = new ConcurrentHashMap>>(); /** * Creates the Item using these Parameters. diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java index 72b1485a8b..9020eb09e8 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java @@ -31,6 +31,7 @@ import squeek.applecore.api.food.FoodValues; import squeek.applecore.api.food.IEdible; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import static gregtech.api.enums.GT_Values.*; @@ -54,7 +55,7 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements *

* You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. */ - public static final HashMap sInstances = new HashMap(); + public static final ConcurrentHashMap sInstances = new ConcurrentHashMap(); /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ @@ -63,10 +64,10 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements public final BitSet mVisibleItems; public final IIcon[][] mIconList; - public final HashMap mFoodStats = new HashMap(); - public final HashMap mElectricStats = new HashMap(); - public final HashMap mFluidContainerStats = new HashMap(); - public final HashMap mBurnValues = new HashMap(); + public final ConcurrentHashMap mFoodStats = new ConcurrentHashMap(); + public final ConcurrentHashMap mElectricStats = new ConcurrentHashMap(); + public final ConcurrentHashMap mFluidContainerStats = new ConcurrentHashMap(); + public final ConcurrentHashMap mBurnValues = new ConcurrentHashMap(); /** * Creates the Item using these Parameters. diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java index b49128878d..112cc510f3 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java @@ -43,9 +43,9 @@ import net.minecraftforge.common.IShearable; import net.minecraftforge.event.world.BlockEvent; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; import static gregtech.api.enums.GT_Values.MOD_ID_FR; import static gregtech.api.enums.GT_Values.MOD_ID_RC; @@ -62,11 +62,11 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements *

* You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. */ - public static final HashMap sInstances = new HashMap(); + public static final ConcurrentHashMap sInstances = new ConcurrentHashMap(); /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - public final HashMap mToolStats = new HashMap(); + public final ConcurrentHashMap mToolStats = new ConcurrentHashMap(); /** * Creates the Item using these Parameters. @@ -605,7 +605,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements return false; } Materials aMaterial = getPrimaryMaterial(aStack); - HashMap tMap = new HashMap(), tResult = new HashMap(); + ConcurrentHashMap tMap = new ConcurrentHashMap(), tResult = new ConcurrentHashMap(); if (aMaterial.mEnchantmentTools != null) { tMap.put(aMaterial.mEnchantmentTools.effectId, (int) aMaterial.mEnchantmentToolsLevel); if (aMaterial.mEnchantmentTools == Enchantment.fortune) diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index b7662569dc..560ddb0947 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -28,8 +28,8 @@ import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; import java.util.ArrayList; -import java.util.HashMap; import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; import static gregtech.api.enums.GT_Values.D1; @@ -187,7 +187,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } if (mLastReceivedFrom == oLastReceivedFrom) { - HashMap tTanks = new HashMap(); + ConcurrentHashMap tTanks = new ConcurrentHashMap(); mConnections = 0; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java index 7cb88cb0cd..0a3ee8d5ce 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java @@ -19,7 +19,7 @@ import net.minecraft.tileentity.TileEntityDispenser; import net.minecraft.tileentity.TileEntityHopper; import java.util.ArrayList; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileEntityItemPipe { public final float mThickNess; @@ -205,7 +205,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE for (boolean temp = true; temp && !isInventoryEmpty() && pipeCapacityCheck(); ) { temp = false; tPipeList.clear(); - for (IMetaTileEntityItemPipe tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes(this, new HashMap(), 0, false, false)).keySet()) { + for (IMetaTileEntityItemPipe tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes(this, new ConcurrentHashMap(), 0, false, false)).keySet()) { if (temp) break; tPipeList.add(tTileEntity); while (!temp && !isInventoryEmpty() && tTileEntity.sendItemStack(aBaseMetaTileEntity)) diff --git a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java index caf46b3980..12c2e28a37 100644 --- a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java +++ b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java @@ -36,7 +36,7 @@ public class GT_CopiedBlockTexture implements ITexture { this(aBlock, aSide, aMeta, Dyes._NULL.mRGBa); } - private IIcon getIcon(int aSide) { + private final IIcon getIcon(int aSide) { if (mSide == 6) return mBlock.getIcon(aSide, mMeta); return mBlock.getIcon(mSide, mMeta); } diff --git a/src/main/java/gregtech/api/objects/GT_FluidStack.java b/src/main/java/gregtech/api/objects/GT_FluidStack.java index 3f9e52818c..d2fdbbfb47 100644 --- a/src/main/java/gregtech/api/objects/GT_FluidStack.java +++ b/src/main/java/gregtech/api/objects/GT_FluidStack.java @@ -29,7 +29,7 @@ public class GT_FluidStack extends FluidStack { this(aFluid.getFluid(), aFluid.amount); } - public static synchronized void fixAllThoseFuckingFluidIDs() { + public static final synchronized void fixAllThoseFuckingFluidIDs() { if (ForgeVersion.getBuildVersion() < 1355) { while (lock) { try { @@ -49,7 +49,7 @@ public class GT_FluidStack extends FluidStack { } } - public void fixFluidIDForFucksSake() { + public final void fixFluidIDForFucksSake() { if (ForgeVersion.getBuildVersion() < 1355) { int fluidID; try { diff --git a/src/main/java/gregtech/api/objects/GT_HashSet.java b/src/main/java/gregtech/api/objects/GT_HashSet.java index cec006905b..32d8319cb5 100644 --- a/src/main/java/gregtech/api/objects/GT_HashSet.java +++ b/src/main/java/gregtech/api/objects/GT_HashSet.java @@ -8,26 +8,26 @@ import java.util.*; public class GT_HashSet extends AbstractSet { private static final Object OBJECT = new Object(); - private transient HashMap map; + private transient Map map; public GT_HashSet() { - map = new HashMap(); + map = new WeakHashMap(); GregTech_API.sItemStackMappings.add(map); } public GT_HashSet(Collection c) { - map = new HashMap(Math.max((int) (c.size() / .75f) + 1, 16)); + map = new WeakHashMap(Math.max((int) (c.size() / .75f) + 1, 16)); addAll(c); GregTech_API.sItemStackMappings.add(map); } public GT_HashSet(int initialCapacity, float loadFactor) { - map = new HashMap(initialCapacity, loadFactor); + map = new WeakHashMap(initialCapacity, loadFactor); GregTech_API.sItemStackMappings.add(map); } public GT_HashSet(int initialCapacity) { - map = new HashMap(initialCapacity); + map = new WeakHashMap(initialCapacity); GregTech_API.sItemStackMappings.add(map); } @@ -36,7 +36,7 @@ public class GT_HashSet extends AbstractSet { GregTech_API.sItemStackMappings.add(map); } - public HashMap getMap() { + public final Map getMap() { return map; } diff --git a/src/main/java/gregtech/api/objects/GT_ItemStack.java b/src/main/java/gregtech/api/objects/GT_ItemStack.java index f865b348a0..9791cadeeb 100644 --- a/src/main/java/gregtech/api/objects/GT_ItemStack.java +++ b/src/main/java/gregtech/api/objects/GT_ItemStack.java @@ -24,16 +24,16 @@ public class GT_ItemStack { this(GT_Utility.intToStack(aHashCode)); } - public ItemStack toStack() { + public final ItemStack toStack() { if (mItem == null) return null; return new ItemStack(mItem, 1, mMetaData); } - public boolean isStackEqual(ItemStack aStack) { + public final boolean isStackEqual(ItemStack aStack) { return GT_Utility.areStacksEqual(toStack(), aStack); } - public boolean isStackEqual(GT_ItemStack aStack) { + public final boolean isStackEqual(GT_ItemStack aStack) { return GT_Utility.areStacksEqual(toStack(), aStack.toStack()); } diff --git a/src/main/java/gregtech/api/objects/ItemData.java b/src/main/java/gregtech/api/objects/ItemData.java index aedc48db5a..e4a39fd532 100644 --- a/src/main/java/gregtech/api/objects/ItemData.java +++ b/src/main/java/gregtech/api/objects/ItemData.java @@ -93,26 +93,26 @@ public class ItemData { mByProducts = rList.toArray(new MaterialStack[rList.size()]); } - public boolean hasValidPrefixMaterialData() { + public final boolean hasValidPrefixMaterialData() { return mPrefix != null && mMaterial != null && mMaterial.mMaterial != null; } - public boolean hasValidPrefixData() { + public final boolean hasValidPrefixData() { return mPrefix != null; } - public boolean hasValidMaterialData() { + public final boolean hasValidMaterialData() { return mMaterial != null && mMaterial.mMaterial != null; } - public ArrayList getAllMaterialStacks() { + public final ArrayList getAllMaterialStacks() { ArrayList rList = new ArrayList(); if (hasValidMaterialData()) rList.add(mMaterial); rList.addAll(Arrays.asList(mByProducts)); return rList; } - public MaterialStack getByProduct(int aIndex) { + public final MaterialStack getByProduct(int aIndex) { return aIndex >= 0 && aIndex < mByProducts.length ? mByProducts[aIndex] : null; } diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index b22650df0d..00d637398d 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -57,12 +57,12 @@ public class GT_ModHandler { public static Collection sNativeRecipeClasses = new HashSet(), sSpecialRecipeClasses = new HashSet(); public static GT_HashSet sNonReplaceableItems = new GT_HashSet(); public static Object sBoxableWrapper = GT_Utility.callConstructor("gregtechmod.api.util.GT_IBoxableWrapper", 0, null, false); - private static Map sExtractorRecipes = new HashMap(); - private static Map sMaceratorRecipes = new HashMap(); - private static Map sCompressorRecipes = new HashMap(); - private static Map sOreWashingRecipes = new HashMap(); - private static Map sThermalCentrifugeRecipes = new HashMap(); - private static Map sMassfabRecipes = new HashMap(); + private static Map sExtractorRecipes = new /*Concurrent*/HashMap(); + private static Map sMaceratorRecipes = new /*Concurrent*/HashMap(); + private static Map sCompressorRecipes = new /*Concurrent*/HashMap(); + private static Map sOreWashingRecipes = new /*Concurrent*/HashMap(); + private static Map sThermalCentrifugeRecipes = new /*Concurrent*/HashMap(); + private static Map sMassfabRecipes = new /*Concurrent*/HashMap(); private static boolean sBufferCraftingRecipes = true; public static List sSingleNonBlockDamagableRecipeList_list = new ArrayList(100); private static boolean sSingleNonBlockDamagableRecipeList_create = true; @@ -921,8 +921,8 @@ public class GT_ModHandler { if (aRecipe[idx] instanceof Boolean) { idx++; } - HashMap tItemStackMap = new HashMap(); - HashMap tItemDataMap = new HashMap(); + /*ConcurrentHash*/Map tItemStackMap = new /*ConcurrentHash*/HashMap(); + /*ConcurrentHash*/Map tItemDataMap = new /*ConcurrentHash*/HashMap(); tItemStackMap.put(' ', null); boolean tRemoveRecipe = true; diff --git a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java index b404299fad..dddf2ec576 100644 --- a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java +++ b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java @@ -15,6 +15,7 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import java.util.HashMap; +import java.util.Map; import java.util.Map.Entry; import static gregtech.api.enums.GT_Values.*; @@ -29,8 +30,8 @@ import static gregtech.api.enums.GT_Values.*; * P.S. It is intended to be named "Unificator" and not "Unifier", because that sounds more awesome. */ public class GT_OreDictUnificator { - private static final HashMap sName2StackMap = new HashMap(); - private static final HashMap sItemStack2DataMap = new HashMap(); + private static final /*ConcurrentHash*/Map sName2StackMap = new /*ConcurrentHash*/HashMap(); + private static final /*ConcurrentHash*/Map sItemStack2DataMap = new /*ConcurrentHash*/HashMap(); private static final GT_HashSet sNoUnificationList = new GT_HashSet(); public static volatile int VERSION = 509; private static int isRegisteringOre = 0, isAddingOre = 0; diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 3d45dee234..fc3b600d07 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -514,11 +514,11 @@ public class GT_Recipe { /** * HashMap of Recipes based on their Items */ - public final Map> mRecipeItemMap = new HashMap>(); + public final Map> mRecipeItemMap = new /*Concurrent*/HashMap>(); /** * HashMap of Recipes based on their Fluids */ - public final Map> mRecipeFluidMap = new HashMap>(); + public final Map> mRecipeFluidMap = new /*Concurrent*/HashMap>(); /** * The List of all Recipes */ diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 571715907f..7d163c45b9 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -20,7 +20,6 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.ItemData; import gregtech.api.threads.GT_Runnable_Sound; import gregtech.common.GT_Proxy; -import ic2.api.recipe.ICannerBottleRecipeManager; import ic2.api.recipe.IRecipeInput; import ic2.api.recipe.RecipeInputItemStack; import ic2.api.recipe.RecipeInputOreDict; @@ -84,11 +83,11 @@ public class GT_Utility { * Forge screwed the Fluid Registry up again, so I make my own, which is also much more efficient than the stupid Stuff over there. */ private static final List sFluidContainerList = new ArrayList(); - private static final Map sFilledContainerToData = new HashMap(); - private static final Map> sEmptyContainerToFluidToData = new HashMap>(); + private static final Map sFilledContainerToData = new /*Concurrent*/HashMap(); + private static final Map> sEmptyContainerToFluidToData = new /*Concurrent*/HashMap>(); public static volatile int VERSION = 509; public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true, RF_CHECK = false; - public static Map sPlayedSoundMap = new HashMap(); + public static Map sPlayedSoundMap = new /*Concurrent*/HashMap(); private static int sBookCount = 0; static { @@ -707,7 +706,7 @@ public class GT_Utility { sFilledContainerToData.put(new GT_ItemStack(tData.filledContainer), tData); Map tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(tData.emptyContainer)); if (tFluidToContainer == null) { - sEmptyContainerToFluidToData.put(new GT_ItemStack(tData.emptyContainer), tFluidToContainer = new HashMap()); + sEmptyContainerToFluidToData.put(new GT_ItemStack(tData.emptyContainer), tFluidToContainer = new /*Concurrent*/HashMap()); GregTech_API.sFluidMappings.add(tFluidToContainer); } tFluidToContainer.put(tData.fluid.getFluid(), tData); @@ -719,7 +718,7 @@ public class GT_Utility { sFilledContainerToData.put(new GT_ItemStack(aData.filledContainer), aData); Map tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(aData.emptyContainer)); if (tFluidToContainer == null) { - sEmptyContainerToFluidToData.put(new GT_ItemStack(aData.emptyContainer), tFluidToContainer = new HashMap()); + sEmptyContainerToFluidToData.put(new GT_ItemStack(aData.emptyContainer), tFluidToContainer = new /*Concurrent*/HashMap()); GregTech_API.sFluidMappings.add(tFluidToContainer); } tFluidToContainer.put(aData.fluid.getFluid(), aData); @@ -1408,7 +1407,7 @@ public class GT_Utility { * re-maps all Keys of a Map after the Keys were weakened. */ public static Map reMap(Map aMap) { - Map tMap = new HashMap(); + Map tMap = new /*Concurrent*/HashMap(); tMap.putAll(aMap); aMap.clear(); aMap.putAll(tMap); diff --git a/src/main/java/gregtech/api/world/GT_Worldgen.java b/src/main/java/gregtech/api/world/GT_Worldgen.java index e41e2abefe..e464c475f1 100644 --- a/src/main/java/gregtech/api/world/GT_Worldgen.java +++ b/src/main/java/gregtech/api/world/GT_Worldgen.java @@ -4,16 +4,16 @@ import gregtech.api.GregTech_API; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; +import java.util.concurrent.ConcurrentHashMap; public abstract class GT_Worldgen { public final String mWorldGenName; public final boolean mEnabled; - private final Map mDimensionMap = new HashMap(); + private final Map mDimensionMap = new ConcurrentHashMap(); public GT_Worldgen(String aName, List aList, boolean aDefault) { mWorldGenName = aName; diff --git a/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java b/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java index bdba08bfb2..e8d16526c1 100644 --- a/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java +++ b/src/main/java/gregtech/api/world/GT_Worldgen_Ore.java @@ -11,17 +11,18 @@ public abstract class GT_Worldgen_Ore extends GT_Worldgen { public final Block mBlock; public final Collection mBiomeList; public final boolean mAllowToGenerateinVoid; + private final String aTextWorldgen = "worldgen."; public GT_Worldgen_Ore(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection aBiomeList, boolean aAllowToGenerateinVoid) { super(aName, GregTech_API.sWorldgenList, aDefault); mDimensionType = aDimensionType; mBlock = aBlock; mBlockMeta = Math.min(Math.max(aBlockMeta, 0), 15); - mProbability = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "Probability", aProbability); - mAmount = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "Amount", aAmount); - mSize = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "Size", aSize); - mMinY = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "MinHeight", aMinY); - mMaxY = GregTech_API.sWorldgenFile.get("worldgen." + mWorldGenName, "MaxHeight", aMaxY); + mProbability = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "Probability", aProbability); + mAmount = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "Amount", aAmount); + mSize = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "Size", aSize); + mMinY = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "MinHeight", aMinY); + mMaxY = GregTech_API.sWorldgenFile.get(aTextWorldgen + mWorldGenName, "MaxHeight", aMaxY); if (aBiomeList == null) mBiomeList = new ArrayList(); else mBiomeList = aBiomeList; mAllowToGenerateinVoid = aAllowToGenerateinVoid; diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 20e024292c..f242c318f6 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -164,6 +164,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { public int mWireHeatingTicks = 4; public boolean mHideUnusedOres = true; public boolean mHideRecyclingRecipes = true; + private final String aTextThermalExpansion = "ThermalExpansion"; + private final String aTextRailcraft = "Railcraft"; + private final String aTextTwilightForest = "TwilightForest"; + private final String aTextForestry = "Forestry"; + private final String aTextArsmagica2 = "arsmagica2"; public GT_Proxy() { GameRegistry.registerFuelHandler(this); @@ -215,56 +220,56 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } } GT_Log.out.println("GT_Mod: Getting required Items of other Mods."); - ItemList.TE_Slag.set(GT_ModHandler.getModItem("ThermalExpansion", "slag", 1L)); - ItemList.TE_Slag_Rich.set(GT_ModHandler.getModItem("ThermalExpansion", "slagRich", 1L)); - ItemList.TE_Rockwool.set(GT_ModHandler.getModItem("ThermalExpansion", "rockwool", 1L)); - ItemList.TE_Hardened_Glass.set(GT_ModHandler.getModItem("ThermalExpansion", "glassHardened", 1L)); - - ItemList.RC_ShuntingWire.set(GT_ModHandler.getModItem("Railcraft", "tile.railcraft.machine.delta", 1L, 0)); - ItemList.RC_ShuntingWireFrame.set(GT_ModHandler.getModItem("Railcraft", "tile.railcraft.frame", 1L, 0)); - ItemList.RC_Rail_Standard.set(GT_ModHandler.getModItem("Railcraft", "part.rail", 1L, 0)); - ItemList.RC_Rail_Adv.set(GT_ModHandler.getModItem("Railcraft", "part.rail", 1L, 1)); - ItemList.RC_Rail_Wooden.set(GT_ModHandler.getModItem("Railcraft", "part.rail", 1L, 2)); - ItemList.RC_Rail_HS.set(GT_ModHandler.getModItem("Railcraft", "part.rail", 1L, 3)); - ItemList.RC_Rail_Reinforced.set(GT_ModHandler.getModItem("Railcraft", "part.rail", 1L, 4)); - ItemList.RC_Rail_Electric.set(GT_ModHandler.getModItem("Railcraft", "part.rail", 1L, 5)); - ItemList.RC_Tie_Wood.set(GT_ModHandler.getModItem("Railcraft", "part.tie", 1L, 0)); - ItemList.RC_Tie_Stone.set(GT_ModHandler.getModItem("Railcraft", "part.tie", 1L, 1)); - ItemList.RC_Bed_Wood.set(GT_ModHandler.getModItem("Railcraft", "part.railbed", 1L, 0)); - ItemList.RC_Bed_Stone.set(GT_ModHandler.getModItem("Railcraft", "part.railbed", 1L, 1)); - ItemList.RC_Rebar.set(GT_ModHandler.getModItem("Railcraft", "part.rebar", 1L)); - ItemList.Tool_Sword_Steel.set(GT_ModHandler.getModItem("Railcraft", "tool.steel.sword", 1L)); - ItemList.Tool_Pickaxe_Steel.set(GT_ModHandler.getModItem("Railcraft", "tool.steel.pickaxe", 1L)); - ItemList.Tool_Shovel_Steel.set(GT_ModHandler.getModItem("Railcraft", "tool.steel.shovel", 1L)); - ItemList.Tool_Axe_Steel.set(GT_ModHandler.getModItem("Railcraft", "tool.steel.axe", 1L)); - ItemList.Tool_Hoe_Steel.set(GT_ModHandler.getModItem("Railcraft", "tool.steel.hoe", 1L)); - - ItemList.TF_LiveRoot.set(GT_ModHandler.getModItem("TwilightForest", "item.liveRoot", 1L, 0)); - ItemList.TF_Vial_FieryBlood.set(GT_ModHandler.getModItem("TwilightForest", "item.fieryBlood", 1L)); - ItemList.TF_Vial_FieryTears.set(GT_ModHandler.getModItem("TwilightForest", "item.fieryTears", 1L)); - - ItemList.FR_Lemon.set(GT_ModHandler.getModItem("Forestry", "fruits", 1L, 3)); - ItemList.FR_Mulch.set(GT_ModHandler.getModItem("Forestry", "mulch", 1L)); - ItemList.FR_Fertilizer.set(GT_ModHandler.getModItem("Forestry", "fertilizerCompound", 1L)); - ItemList.FR_Compost.set(GT_ModHandler.getModItem("Forestry", "fertilizerBio", 1L)); - ItemList.FR_Silk.set(GT_ModHandler.getModItem("Forestry", "craftingMaterial", 1L, 2)); - ItemList.FR_Wax.set(GT_ModHandler.getModItem("Forestry", "beeswax", 1L)); - ItemList.FR_WaxCapsule.set(GT_ModHandler.getModItem("Forestry", "waxCapsule", 1L)); - ItemList.FR_RefractoryWax.set(GT_ModHandler.getModItem("Forestry", "refractoryWax", 1L)); - ItemList.FR_RefractoryCapsule.set(GT_ModHandler.getModItem("Forestry", "refractoryEmpty", 1L)); - ItemList.FR_Bee_Drone.set(GT_ModHandler.getModItem("Forestry", "beeDroneGE", 1L)); - ItemList.FR_Bee_Princess.set(GT_ModHandler.getModItem("Forestry", "beePrincessGE", 1L)); - ItemList.FR_Bee_Queen.set(GT_ModHandler.getModItem("Forestry", "beeQueenGE", 1L)); - ItemList.FR_Tree_Sapling.set(GT_ModHandler.getModItem("Forestry", "sapling", 1L, GT_ModHandler.getModItem("Forestry", "saplingGE", 1L))); - ItemList.FR_Butterfly.set(GT_ModHandler.getModItem("Forestry", "butterflyGE", 1L)); - ItemList.FR_Larvae.set(GT_ModHandler.getModItem("Forestry", "beeLarvaeGE", 1L)); - ItemList.FR_Serum.set(GT_ModHandler.getModItem("Forestry", "serumGE", 1L)); - ItemList.FR_Caterpillar.set(GT_ModHandler.getModItem("Forestry", "caterpillarGE", 1L)); - ItemList.FR_PollenFertile.set(GT_ModHandler.getModItem("Forestry", "pollenFertile", 1L)); - ItemList.FR_Stick.set(GT_ModHandler.getModItem("Forestry", "oakStick", 1L)); - ItemList.FR_Casing_Impregnated.set(GT_ModHandler.getModItem("Forestry", "impregnatedCasing", 1L)); - ItemList.FR_Casing_Sturdy.set(GT_ModHandler.getModItem("Forestry", "sturdyMachine", 1L)); - ItemList.FR_Casing_Hardened.set(GT_ModHandler.getModItem("Forestry", "hardenedMachine", 1L)); + ItemList.TE_Slag.set(GT_ModHandler.getModItem(aTextThermalExpansion, "slag", 1L)); + ItemList.TE_Slag_Rich.set(GT_ModHandler.getModItem(aTextThermalExpansion, "slagRich", 1L)); + ItemList.TE_Rockwool.set(GT_ModHandler.getModItem(aTextThermalExpansion, "rockwool", 1L)); + ItemList.TE_Hardened_Glass.set(GT_ModHandler.getModItem(aTextThermalExpansion, "glassHardened", 1L)); + + ItemList.RC_ShuntingWire.set(GT_ModHandler.getModItem(aTextRailcraft, "tile.railcraft.machine.delta", 1L, 0)); + ItemList.RC_ShuntingWireFrame.set(GT_ModHandler.getModItem(aTextRailcraft, "tile.railcraft.frame", 1L, 0)); + ItemList.RC_Rail_Standard.set(GT_ModHandler.getModItem(aTextRailcraft, "part.rail", 1L, 0)); + ItemList.RC_Rail_Adv.set(GT_ModHandler.getModItem(aTextRailcraft, "part.rail", 1L, 1)); + ItemList.RC_Rail_Wooden.set(GT_ModHandler.getModItem(aTextRailcraft, "part.rail", 1L, 2)); + ItemList.RC_Rail_HS.set(GT_ModHandler.getModItem(aTextRailcraft, "part.rail", 1L, 3)); + ItemList.RC_Rail_Reinforced.set(GT_ModHandler.getModItem(aTextRailcraft, "part.rail", 1L, 4)); + ItemList.RC_Rail_Electric.set(GT_ModHandler.getModItem(aTextRailcraft, "part.rail", 1L, 5)); + ItemList.RC_Tie_Wood.set(GT_ModHandler.getModItem(aTextRailcraft, "part.tie", 1L, 0)); + ItemList.RC_Tie_Stone.set(GT_ModHandler.getModItem(aTextRailcraft, "part.tie", 1L, 1)); + ItemList.RC_Bed_Wood.set(GT_ModHandler.getModItem(aTextRailcraft, "part.railbed", 1L, 0)); + ItemList.RC_Bed_Stone.set(GT_ModHandler.getModItem(aTextRailcraft, "part.railbed", 1L, 1)); + ItemList.RC_Rebar.set(GT_ModHandler.getModItem(aTextRailcraft, "part.rebar", 1L)); + ItemList.Tool_Sword_Steel.set(GT_ModHandler.getModItem(aTextRailcraft, "tool.steel.sword", 1L)); + ItemList.Tool_Pickaxe_Steel.set(GT_ModHandler.getModItem(aTextRailcraft, "tool.steel.pickaxe", 1L)); + ItemList.Tool_Shovel_Steel.set(GT_ModHandler.getModItem(aTextRailcraft, "tool.steel.shovel", 1L)); + ItemList.Tool_Axe_Steel.set(GT_ModHandler.getModItem(aTextRailcraft, "tool.steel.axe", 1L)); + ItemList.Tool_Hoe_Steel.set(GT_ModHandler.getModItem(aTextRailcraft, "tool.steel.hoe", 1L)); + + ItemList.TF_LiveRoot.set(GT_ModHandler.getModItem(aTextTwilightForest, "item.liveRoot", 1L, 0)); + ItemList.TF_Vial_FieryBlood.set(GT_ModHandler.getModItem(aTextTwilightForest, "item.fieryBlood", 1L)); + ItemList.TF_Vial_FieryTears.set(GT_ModHandler.getModItem(aTextTwilightForest, "item.fieryTears", 1L)); + + ItemList.FR_Lemon.set(GT_ModHandler.getModItem(aTextForestry, "fruits", 1L, 3)); + ItemList.FR_Mulch.set(GT_ModHandler.getModItem(aTextForestry, "mulch", 1L)); + ItemList.FR_Fertilizer.set(GT_ModHandler.getModItem(aTextForestry, "fertilizerCompound", 1L)); + ItemList.FR_Compost.set(GT_ModHandler.getModItem(aTextForestry, "fertilizerBio", 1L)); + ItemList.FR_Silk.set(GT_ModHandler.getModItem(aTextForestry, "craftingMaterial", 1L, 2)); + ItemList.FR_Wax.set(GT_ModHandler.getModItem(aTextForestry, "beeswax", 1L)); + ItemList.FR_WaxCapsule.set(GT_ModHandler.getModItem(aTextForestry, "waxCapsule", 1L)); + ItemList.FR_RefractoryWax.set(GT_ModHandler.getModItem(aTextForestry, "refractoryWax", 1L)); + ItemList.FR_RefractoryCapsule.set(GT_ModHandler.getModItem(aTextForestry, "refractoryEmpty", 1L)); + ItemList.FR_Bee_Drone.set(GT_ModHandler.getModItem(aTextForestry, "beeDroneGE", 1L)); + ItemList.FR_Bee_Princess.set(GT_ModHandler.getModItem(aTextForestry, "beePrincessGE", 1L)); + ItemList.FR_Bee_Queen.set(GT_ModHandler.getModItem(aTextForestry, "beeQueenGE", 1L)); + ItemList.FR_Tree_Sapling.set(GT_ModHandler.getModItem(aTextForestry, "sapling", 1L, GT_ModHandler.getModItem(aTextForestry, "saplingGE", 1L))); + ItemList.FR_Butterfly.set(GT_ModHandler.getModItem(aTextForestry, "butterflyGE", 1L)); + ItemList.FR_Larvae.set(GT_ModHandler.getModItem(aTextForestry, "beeLarvaeGE", 1L)); + ItemList.FR_Serum.set(GT_ModHandler.getModItem(aTextForestry, "serumGE", 1L)); + ItemList.FR_Caterpillar.set(GT_ModHandler.getModItem(aTextForestry, "caterpillarGE", 1L)); + ItemList.FR_PollenFertile.set(GT_ModHandler.getModItem(aTextForestry, "pollenFertile", 1L)); + ItemList.FR_Stick.set(GT_ModHandler.getModItem(aTextForestry, "oakStick", 1L)); + ItemList.FR_Casing_Impregnated.set(GT_ModHandler.getModItem(aTextForestry, "impregnatedCasing", 1L)); + ItemList.FR_Casing_Sturdy.set(GT_ModHandler.getModItem(aTextForestry, "sturdyMachine", 1L)); + ItemList.FR_Casing_Hardened.set(GT_ModHandler.getModItem(aTextForestry, "hardenedMachine", 1L)); ItemList.Bottle_Empty.set(new ItemStack(Items.glass_bottle, 1)); @@ -414,32 +419,32 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getIC2Item("hazmatLeggings", 1L, 32767)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Railcraft", "part.turbine.disk", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Railcraft", "part.turbine.blade", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Railcraft", "part.turbine.rotor", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Railcraft", "borehead.diamond", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Railcraft", "borehead.steel", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Railcraft", "borehead.iron", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("TwilightForest", "item.plateNaga", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("TwilightForest", "item.legsNaga", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("TwilightForest", "item.arcticHelm", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("TwilightForest", "item.arcticPlate", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("TwilightForest", "item.arcticLegs", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("TwilightForest", "item.arcticBoots", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("TwilightForest", "item.yetiHelm", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("TwilightForest", "item.yetiPlate", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("TwilightForest", "item.yetiLegs", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("TwilightForest", "item.yetiBoots", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextRailcraft, "part.turbine.disk", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextRailcraft, "part.turbine.blade", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextRailcraft, "part.turbine.rotor", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextRailcraft, "borehead.diamond", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextRailcraft, "borehead.steel", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextRailcraft, "borehead.iron", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextTwilightForest, "item.plateNaga", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextTwilightForest, "item.legsNaga", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextTwilightForest, "item.arcticHelm", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextTwilightForest, "item.arcticPlate", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextTwilightForest, "item.arcticLegs", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextTwilightForest, "item.arcticBoots", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextTwilightForest, "item.yetiHelm", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextTwilightForest, "item.yetiPlate", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextTwilightForest, "item.yetiLegs", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextTwilightForest, "item.yetiBoots", 1L, 32767)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("appliedenergistics2", "item.ToolCertusQuartzCuttingKnife", 1L, 32767)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("appliedenergistics2", "item.ToolNetherQuartzCuttingKnife", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Forestry", "apiaristHelmet", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Forestry", "apiaristChest", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Forestry", "apiaristLegs", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Forestry", "apiaristBoots", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Forestry", "frameUntreated", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Forestry", "frameImpregnated", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Forestry", "frameProven", 1L, 32767)); - GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("Forestry", "waxCast", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextForestry, "apiaristHelmet", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextForestry, "apiaristChest", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextForestry, "apiaristLegs", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextForestry, "apiaristBoots", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextForestry, "frameUntreated", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextForestry, "frameImpregnated", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextForestry, "frameProven", 1L, 32767)); + GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem(aTextForestry, "waxCast", 1L, 32767)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("GalacticraftCore", "item.sensorGlasses", 1L, 32767)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getModItem("IC2NuclearControl", "ItemToolThermometer", 1L, 32767)); @@ -1849,49 +1854,49 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { GregTech_API.sUnification.mConfig.load(); GT_OreDictUnificator.resetUnificationEntries(); for (OreDictEventContainer tOre : this.mEvents) { - if ((!(tOre.mEvent.Ore.getItem() instanceof GT_MetaGenerated_Item)) && (tOre.mPrefix != null) && (tOre.mPrefix.mIsUnificatable) - && (tOre.mMaterial != null)) { - if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("enderio") && tOre.mPrefix == OrePrefixes.ingot && tOre.mMaterial == Materials.DarkSteel) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("thermalfoundation") && tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.Blizz) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("thermalfoundation") && tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.Pyrotheum) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("arsmagica2") && tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.Vinteum) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("arsmagica2") && tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.BlueTopaz) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("arsmagica2") && tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.Chimerite) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("arsmagica2") && tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.Moonstone) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("arsmagica2") && tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.Sunstone) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("rotarycraft") && tOre.mPrefix == OrePrefixes.ingot && tOre.mMaterial == Materials.HSLA) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("appliedenergistics2") && tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.CertusQuartz) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("appliedenergistics2") && tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.CertusQuartz) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals(GT_Values.MOD_ID_TC) && tOre.mPrefix == OrePrefixes.block && tOre.mMaterial == Materials.Thaumium) { - GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true); - } else if (GT_OreDictUnificator.isBlacklisted(tOre.mEvent.Ore)) { + if ((!(tOre.mEvent.Ore.getItem() instanceof GT_MetaGenerated_Item)) && (tOre.mPrefix != null) && (tOre.mPrefix.mIsUnificatable) && (tOre.mMaterial != null)) { + boolean chkmi = tOre.mModID != null ? true : false; + if (chkmi) { + if (tOre.mModID.equalsIgnoreCase("enderio") && tOre.mPrefix == OrePrefixes.ingot && tOre.mMaterial == Materials.DarkSteel) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } else if (tOre.mModID.equalsIgnoreCase("thermalfoundation") && tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.Blizz) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } else if (tOre.mModID.equalsIgnoreCase("thermalfoundation") && tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.Pyrotheum) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } else if (tOre.mModID.equalsIgnoreCase(aTextArsmagica2) && tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.Vinteum) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } else if (tOre.mModID.equalsIgnoreCase(aTextArsmagica2) && tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.BlueTopaz) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } else if (tOre.mModID.equalsIgnoreCase(aTextArsmagica2) && tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.Chimerite) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } else if (tOre.mModID.equalsIgnoreCase(aTextArsmagica2) && tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.Moonstone) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } else if (tOre.mModID.equalsIgnoreCase(aTextArsmagica2) && tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.Sunstone) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } else if (tOre.mModID.equalsIgnoreCase("rotarycraft") && tOre.mPrefix == OrePrefixes.ingot && tOre.mMaterial == Materials.HSLA) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } else if (tOre.mModID.equalsIgnoreCase("appliedenergistics2") && tOre.mPrefix == OrePrefixes.gem && tOre.mMaterial == Materials.CertusQuartz) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } else if (tOre.mModID.equalsIgnoreCase("appliedenergistics2") && tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.CertusQuartz) { + GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, true)), true);continue; + } + } + if (GT_OreDictUnificator.isBlacklisted(tOre.mEvent.Ore)) { GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, true); } else { GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); - GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, false)), true); + GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (chkmi) && (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID).toString(), tOre.mEvent.Name, false)), true); } } } @@ -1903,7 +1908,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } else { GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false); GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && - (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, false)), true); + (GregTech_API.sUnification.get(new StringBuilder().append(ConfigCategories.specialunificationtargets).append(".").append(tOre.mModID), tOre.mEvent.Name, false)), true); } } } diff --git a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java index 0de97a95be..da8fca40b9 100644 --- a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java +++ b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java @@ -31,23 +31,24 @@ public class GT_Worldgen_GT_Ore_Layer public final boolean mNether; public final boolean mEnd; public final boolean mEndAsteroid; + public final String aTextWorldgen = "worldgen."; public GT_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, boolean aOverworld, boolean aNether, boolean aEnd, Materials aPrimary, Materials aSecondary, Materials aBetween, Materials aSporadic) { super(aName, sList, aDefault); - this.mOverworld = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Overworld", aOverworld); - this.mNether = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Nether", aNether); - this.mEnd = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "TheEnd", aEnd); - this.mEndAsteroid = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "EndAsteroid", aEnd); - this.mMinY = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math.max(this.mMinY + 5, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MaxHeight", aMaxY))); - this.mWeight = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "RandomWeight", aWeight)); - this.mDensity = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Density", aDensity)); - this.mSize = ((short) Math.max(1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Size", aSize))); - this.mPrimaryMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); - this.mSecondaryMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); - this.mBetweenMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); - this.mSporadicMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); - this.mBiome = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "BiomeName", "None"); + this.mOverworld = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld); + this.mNether = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Nether", aNether); + this.mEnd = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "TheEnd", aEnd); + this.mEndAsteroid = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "EndAsteroid", aEnd); + this.mMinY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); + this.mMaxY = ((short) Math.max(this.mMinY + 5, GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); + this.mWeight = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); + this.mDensity = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); + this.mSize = ((short) Math.max(1, GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); + this.mPrimaryMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); + this.mSecondaryMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); + this.mBetweenMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); + this.mSporadicMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); + this.mBiome = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "BiomeName", "None"); if (this.mEnabled) { GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd); GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd); diff --git a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java index 6fb3cd4131..eb1e01c463 100644 --- a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java +++ b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_SmallPieces.java @@ -18,18 +18,20 @@ public class GT_Worldgen_GT_Ore_SmallPieces public final boolean mOverworld; public final boolean mNether; public final boolean mEnd; + public final String mBiome; + public final String aTextWorldgen = "worldgen."; public GT_Worldgen_GT_Ore_SmallPieces(String aName, boolean aDefault, int aMinY, int aMaxY, int aAmount, boolean aOverworld, boolean aNether, boolean aEnd, Materials aPrimary) { super(aName, GregTech_API.sWorldgenList, aDefault); - this.mOverworld = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Overworld", aOverworld); - this.mNether = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Nether", aNether); - this.mEnd = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "TheEnd", aEnd); - this.mMinY = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math.max(this.mMinY + 1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "MaxHeight", aMaxY))); - this.mAmount = ((short) Math.max(1, GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Amount", aAmount))); - this.mMeta = ((short) GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "Ore", aPrimary.mMetaItemSubID)); - this.mBiome = GregTech_API.sWorldgenFile.get("worldgen." + this.mWorldGenName, "BiomeName", "None"); + this.mOverworld = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld); + this.mNether = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Nether", aNether); + this.mEnd = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "TheEnd", aEnd); + this.mMinY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); + this.mMaxY = ((short) Math.max(this.mMinY + 1, GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); + this.mAmount = ((short) Math.max(1, GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Amount", aAmount))); + this.mMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Ore", aPrimary.mMetaItemSubID)); + this.mBiome = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "BiomeName", "None"); } public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java index 5b314ae5b4..d5dc9a6d57 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java @@ -36,6 +36,10 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements public static ThreadLocal mTemporaryTileEntity = new ThreadLocal(); public static boolean FUCKING_LOCK = false; public static boolean tHideOres; + private final String aTextName = ".name"; + private final String aTextSmall = "Small "; + private final String aTextDot = "."; + private final String aTextNothing = ""; protected GT_Block_Ores_Abstract(String aUnlocalizedName, boolean aHideFirstMeta, Material aMaterial) { super(GT_Item_Ores.class, aUnlocalizedName, aMaterial); @@ -48,31 +52,31 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements } for (int i = 1; i < GregTech_API.sGeneratedMaterials.length; i++) { if (GregTech_API.sGeneratedMaterials[i] != null) { - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + i + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 1000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 2000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 3000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 4000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 5000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 6000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 7000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 16000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 17000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 18000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 19000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 20000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 21000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 22000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 23000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + i + aTextName, getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 1000) + aTextName, getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 2000) + aTextName, getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 3000) + aTextName, getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 4000) + aTextName, getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 5000) + aTextName, getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 6000) + aTextName, getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 7000) + aTextName, getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 16000) + aTextName, aTextSmall + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 17000) + aTextName, aTextSmall + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 18000) + aTextName, aTextSmall + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 19000) + aTextName, aTextSmall + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 20000) + aTextName, aTextSmall + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 21000) + aTextName, aTextSmall + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 22000) + aTextName, aTextSmall + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + aTextDot + (i + 23000) + aTextName, aTextSmall + getLocalizedName(GregTech_API.sGeneratedMaterials[i])); if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0) { - GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[0] != null ? this.getProcessingPrefix()[0].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i)); - GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[1] != null ? this.getProcessingPrefix()[1].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 1000)); - GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[2] != null ? this.getProcessingPrefix()[2].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 2000)); - GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[3] != null ? this.getProcessingPrefix()[3].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 3000)); - GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[4] != null ? this.getProcessingPrefix()[4].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 4000)); - GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[5] != null ? this.getProcessingPrefix()[5].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 5000)); - GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[6] != null ? this.getProcessingPrefix()[6].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 6000)); - GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[7] != null ? this.getProcessingPrefix()[7].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + 7000)); + GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[0] != null ? this.getProcessingPrefix()[0].get(GregTech_API.sGeneratedMaterials[i]) : aTextNothing, new ItemStack(this, 1, i)); + GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[1] != null ? this.getProcessingPrefix()[1].get(GregTech_API.sGeneratedMaterials[i]) : aTextNothing, new ItemStack(this, 1, i + 1000)); + GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[2] != null ? this.getProcessingPrefix()[2].get(GregTech_API.sGeneratedMaterials[i]) : aTextNothing, new ItemStack(this, 1, i + 2000)); + GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[3] != null ? this.getProcessingPrefix()[3].get(GregTech_API.sGeneratedMaterials[i]) : aTextNothing, new ItemStack(this, 1, i + 3000)); + GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[4] != null ? this.getProcessingPrefix()[4].get(GregTech_API.sGeneratedMaterials[i]) : aTextNothing, new ItemStack(this, 1, i + 4000)); + GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[5] != null ? this.getProcessingPrefix()[5].get(GregTech_API.sGeneratedMaterials[i]) : aTextNothing, new ItemStack(this, 1, i + 5000)); + GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[6] != null ? this.getProcessingPrefix()[6].get(GregTech_API.sGeneratedMaterials[i]) : aTextNothing, new ItemStack(this, 1, i + 6000)); + GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[7] != null ? this.getProcessingPrefix()[7].get(GregTech_API.sGeneratedMaterials[i]) : aTextNothing, new ItemStack(this, 1, i + 7000)); if (tHideOres) { if (aHideFirstMeta) codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i)); codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 1000)); @@ -180,7 +184,7 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements public abstract String getUnlocalizedName(); public String getLocalizedName() { - return StatCollector.translateToLocal(getUnlocalizedName() + ".name"); + return StatCollector.translateToLocal(getUnlocalizedName() + aTextName); } public int getRenderType() { @@ -268,22 +272,22 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) { Materials tMaterial = GregTech_API.sGeneratedMaterials[i]; if ((tMaterial != null) && ((tMaterial.mTypes & 0x8) != 0)) { - aList.add(new ItemStack(aItem, 1, i)); - aList.add(new ItemStack(aItem, 1, i + 1000)); - aList.add(new ItemStack(aItem, 1, i + 2000)); - aList.add(new ItemStack(aItem, 1, i + 3000)); - aList.add(new ItemStack(aItem, 1, i + 4000)); - aList.add(new ItemStack(aItem, 1, i + 5000)); - aList.add(new ItemStack(aItem, 1, i + 6000)); - aList.add(new ItemStack(aItem, 1, i + 7000)); - aList.add(new ItemStack(aItem, 1, i + 16000)); - aList.add(new ItemStack(aItem, 1, i + 17000)); - aList.add(new ItemStack(aItem, 1, i + 18000)); - aList.add(new ItemStack(aItem, 1, i + 19000)); - aList.add(new ItemStack(aItem, 1, i + 20000)); - aList.add(new ItemStack(aItem, 1, i + 21000)); - aList.add(new ItemStack(aItem, 1, i + 22000)); - aList.add(new ItemStack(aItem, 1, i + 23000)); + if (!(new ItemStack(aItem, 1, i).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i)); + if (!(new ItemStack(aItem, 1, i + 1000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 1000)); + if (!(new ItemStack(aItem, 1, i + 2000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 2000)); + if (!(new ItemStack(aItem, 1, i + 3000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 3000)); + if (!(new ItemStack(aItem, 1, i + 4000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 4000)); + if (!(new ItemStack(aItem, 1, i + 5000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 5000)); + if (!(new ItemStack(aItem, 1, i + 6000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 6000)); + if (!(new ItemStack(aItem, 1, i + 7000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 7000)); + if (!(new ItemStack(aItem, 1, i + 16000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 16000)); + if (!(new ItemStack(aItem, 1, i + 17000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 17000)); + if (!(new ItemStack(aItem, 1, i + 18000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 18000)); + if (!(new ItemStack(aItem, 1, i + 19000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 19000)); + if (!(new ItemStack(aItem, 1, i + 20000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 20000)); + if (!(new ItemStack(aItem, 1, i + 21000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 21000)); + if (!(new ItemStack(aItem, 1, i + 22000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 22000)); + if (!(new ItemStack(aItem, 1, i + 23000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 23000)); } } } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java index 049a5bfbcb..90d882f048 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java @@ -14,8 +14,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import java.util.HashMap; import java.util.List; +import java.util.concurrent.ConcurrentHashMap; public class Behaviour_Plunger_Item extends Behaviour_None { @@ -34,7 +34,7 @@ public class Behaviour_Plunger_Item if ((aTileEntity instanceof IGregTechTileEntity)) { IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aTileEntity).getMetaTileEntity(); if ((tMetaTileEntity instanceof IMetaTileEntityItemPipe)) { - for (Object tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, new HashMap(), 0L, false, true)).keySet()) + for (Object tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, new ConcurrentHashMap(), 0L, false, true)).keySet()) { int i = 0; diff --git a/src/main/java/gregtech/loaders/misc/GT_Achievements.java b/src/main/java/gregtech/loaders/misc/GT_Achievements.java index f16aa8a00d..ed02167284 100644 --- a/src/main/java/gregtech/loaders/misc/GT_Achievements.java +++ b/src/main/java/gregtech/loaders/misc/GT_Achievements.java @@ -30,22 +30,22 @@ import net.minecraftforge.fluids.FluidStack; import thaumcraft.api.ThaumcraftApiHelper; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; +import java.util.concurrent.ConcurrentHashMap; public class GT_Achievements { public static List oreList = new ArrayList(); public static List oreStats = new ArrayList(); public static int oreReg = -1; - public HashMap achievementList; - public HashMap issuedAchievements; + public ConcurrentHashMap achievementList; + public ConcurrentHashMap issuedAchievements; public int adjX = 5; public int adjY = 9; public GT_Achievements() { - this.achievementList = new HashMap(); - this.issuedAchievements = new HashMap(); + this.achievementList = new ConcurrentHashMap(); + this.issuedAchievements = new ConcurrentHashMap(); int oreList_sS=oreList.size(); for (int i = 0; i < oreList_sS; i++) { if (GT_Values.D1 && this.achievementList.get(oreList.get(i).name()) == null) { -- cgit From 04fec51acb0f1053dfea595c04ea0862da1d4f37 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sat, 13 Aug 2016 09:10:38 +0100 Subject: Remove null checks --- src/main/java/gregtech/GT_Mod.java | 4 ++-- src/main/java/gregtech/api/enums/Dyes.java | 2 +- src/main/java/gregtech/api/enums/Materials.java | 2 +- src/main/java/gregtech/api/enums/OrePrefixes.java | 2 +- .../metatileentity/IMetaTileEntityItemPipe.java | 6 +++--- .../gregtech/api/items/GT_Spray_Hardener_Item.java | 2 +- .../api/metatileentity/BaseMetaTileEntity.java | 2 +- .../api/metatileentity/BaseMetaTileEntityUE.java | 4 ++-- .../api/threads/GT_Runnable_MachineBlockUpdate.java | 4 ++-- src/main/java/gregtech/api/util/GT_PlayedSound.java | 2 +- src/main/java/gregtech/api/util/GT_Utility.java | 20 +++++++++++--------- .../gregtech/common/blocks/GT_Block_Machines.java | 11 +++++------ .../common/blocks/GT_Block_Ores_Abstract.java | 2 +- .../gregtech/common/entities/GT_Entity_Arrow.java | 2 +- .../gregtech/common/items/GT_SensorCard_Item.java | 2 +- .../common/items/behaviors/Behaviour_Wrench.java | 2 +- .../machines/basic/GT_MetaTileEntity_Pump.java | 2 +- .../java/gregtech/loaders/load/GT_ItemIterator.java | 2 +- 18 files changed, 37 insertions(+), 36 deletions(-) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 576ba97658..4775792e50 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -71,11 +71,11 @@ public class GT_Mod private final String aTextGeneral = "general"; private final String aTextIC2 = "ic2_"; - /*static { + static { if ((509 != GregTech_API.VERSION) || (509 != GT_ModHandler.VERSION) || (509 != GT_OreDictUnificator.VERSION) || (509 != GT_Recipe.VERSION) || (509 != GT_Utility.VERSION) || (509 != GT_RecipeRegistrator.VERSION) || (509 != Element.VERSION) || (509 != Materials.VERSION) || (509 != OrePrefixes.VERSION)) { throw new GT_ItsNotMyFaultException("One of your Mods included GregTech-API Files inside it's download, mention this to the Mod Author, who does this bad thing, and tell him/her to use reflection. I have added a Version check, to prevent Authors from breaking my Mod that way."); } - }*/ + } public GT_Mod() { try { diff --git a/src/main/java/gregtech/api/enums/Dyes.java b/src/main/java/gregtech/api/enums/Dyes.java index 66c3927783..c59b310d55 100644 --- a/src/main/java/gregtech/api/enums/Dyes.java +++ b/src/main/java/gregtech/api/enums/Dyes.java @@ -64,7 +64,7 @@ public enum Dyes implements IColorModulationContainer { public static Dyes get(String aColor) { Object tObject = GT_Utility.getFieldContent(Dyes.class, aColor, false, false); - if (tObject != null && tObject instanceof Dyes) return (Dyes) tObject; + if (tObject instanceof Dyes) return (Dyes) tObject; return _NULL; } diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index a3ef13b9fd..f0883196ae 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -1423,7 +1423,7 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer { public static Materials get(String aMaterialName) { Object tObject = GT_Utility.getFieldContent(Materials.class, aMaterialName, false, false); - if (tObject != null && tObject instanceof Materials) return (Materials) tObject; + if (tObject instanceof Materials) return (Materials) tObject; return _NULL; } diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index c096a51f4a..da2f76b324 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -639,7 +639,7 @@ public enum OrePrefixes { public static OrePrefixes getPrefix(String aPrefixName, OrePrefixes aReplacement) { Object tObject = GT_Utility.getFieldContent(OrePrefixes.class, aPrefixName, false, false); - if (tObject != null && tObject instanceof OrePrefixes) return (OrePrefixes) tObject; + if (tObject instanceof OrePrefixes) return (OrePrefixes) tObject; return aReplacement; } diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java index 510f314d8c..54f1f484b7 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntityItemPipe.java @@ -65,9 +65,9 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { continue; } } - if (tItemPipe != null && tItemPipe instanceof BaseMetaPipeEntity) { + if (tItemPipe instanceof BaseMetaPipeEntity) { IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); - if (tMetaTileEntity != null && tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsOut(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) { + if (tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsOut(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) { scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, aMap, aStep, aSuckItems, aIgnoreCapacity); } } @@ -84,7 +84,7 @@ public interface IMetaTileEntityItemPipe extends IMetaTileEntity { } if (tItemPipe instanceof BaseMetaPipeEntity) { IMetaTileEntity tMetaTileEntity = tItemPipe.getMetaTileEntity(); - if (tMetaTileEntity != null && tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsIn(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) { + if (tMetaTileEntity instanceof IMetaTileEntityItemPipe && tItemPipe.getCoverBehaviorAtSide(j).letsItemsIn(j, tItemPipe.getCoverIDAtSide(j), tItemPipe.getCoverDataAtSide(j), -2, tItemPipe)) { scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, aMap, aStep, aSuckItems, aIgnoreCapacity); } } diff --git a/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java b/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java index b9b0b7462b..926bcc60dc 100644 --- a/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java +++ b/src/main/java/gregtech/api/items/GT_Spray_Hardener_Item.java @@ -50,7 +50,7 @@ public class GT_Spray_Hardener_Item extends GT_Tool_Item { } ItemStack tStack1 = GT_ModHandler.getIC2Item("constructionFoam", 1), tStack2 = GT_ModHandler.getIC2Item("constructionFoamWall", 1); - if (tStack1 != null && tStack1.isItemEqual(new ItemStack(aBlock)) && tStack2 != null && tStack2.getItem() != null && tStack2.getItem() instanceof ItemBlock) { + if (tStack1 != null && tStack1.isItemEqual(new ItemStack(aBlock)) && tStack2 != null && tStack2.getItem() instanceof ItemBlock) { if (GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(102), 1.0F, -1, aX, aY, aZ); aWorld.setBlock(aX, aY, aZ, GT_Utility.getBlockFromStack(tStack2), 7, 3); diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 1ee4ee50f6..5902a70620 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -398,7 +398,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (getEUCapacity() > 0) { if (GregTech_API.sMachineFireExplosions && getRandomNumber(1000) == 0) { Block tBlock = getBlockAtSide((byte) getRandomNumber(6)); - if (tBlock != null && tBlock instanceof BlockFire) doEnergyExplosion(); + if (tBlock instanceof BlockFire) doEnergyExplosion(); } if (!hasValidMetaTileEntity()) { diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java index 26388bd187..fda019f486 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntityUE.java @@ -75,7 +75,7 @@ public class BaseMetaTileEntityUE extends BaseMetaTileEntity /*implements IUETil for (byte i = 0; i < 6; i++) { if (inputEnergyFrom(i)) { Object tTileEntity = getTileEntityAtSide(i); - if (tTileEntity != null && tTileEntity instanceof IConductor) { + if (tTileEntity instanceof IConductor) { rSides.add(ForgeDirection.getOrientation(i)); } } @@ -88,7 +88,7 @@ public class BaseMetaTileEntityUE extends BaseMetaTileEntity /*implements IUETil for (byte i = 0; i < 6; i++) { if (outputsEnergyTo(i)) { Object tTileEntity = getTileEntityAtSide(i); - if (tTileEntity != null && tTileEntity instanceof IConductor) { + if (tTileEntity instanceof IConductor) { rSides.add(ForgeDirection.getOrientation(i)); } } diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java index 0909229d82..92944d3e32 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java @@ -22,9 +22,9 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { private static void stepToUpdateMachine(World aWorld, int aX, int aY, int aZ, ArrayList aList) { aList.add(new ChunkPosition(aX, aY, aZ)); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity != null && tTileEntity instanceof IMachineBlockUpdateable) + if (tTileEntity instanceof IMachineBlockUpdateable) ((IMachineBlockUpdateable) tTileEntity).onMachineBlockUpdate(); - if (aList.size() < 5 || (tTileEntity != null && tTileEntity instanceof IMachineBlockUpdateable) || GregTech_API.isMachineBlock(aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ))) { + if (aList.size() < 5 || (tTileEntity instanceof IMachineBlockUpdateable) || GregTech_API.isMachineBlock(aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ))) { if (!aList.contains(new ChunkPosition(aX + 1, aY, aZ))) stepToUpdateMachine(aWorld, aX + 1, aY, aZ, aList); if (!aList.contains(new ChunkPosition(aX - 1, aY, aZ))) stepToUpdateMachine(aWorld, aX - 1, aY, aZ, aList); if (!aList.contains(new ChunkPosition(aX, aY + 1, aZ))) stepToUpdateMachine(aWorld, aX, aY + 1, aZ, aList); diff --git a/src/main/java/gregtech/api/util/GT_PlayedSound.java b/src/main/java/gregtech/api/util/GT_PlayedSound.java index 858f3b826e..136171f7b7 100644 --- a/src/main/java/gregtech/api/util/GT_PlayedSound.java +++ b/src/main/java/gregtech/api/util/GT_PlayedSound.java @@ -15,7 +15,7 @@ public class GT_PlayedSound { @Override public boolean equals(Object aObject) { - if (aObject != null && aObject instanceof GT_PlayedSound) { + if (aObject instanceof GT_PlayedSound) { return ((GT_PlayedSound) aObject).mX == mX && ((GT_PlayedSound) aObject).mY == mY && ((GT_PlayedSound) aObject).mZ == mZ && ((GT_PlayedSound) aObject).mSoundName.equals(mSoundName); } return false; diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 7d163c45b9..ee623725fd 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -328,7 +328,7 @@ public class GT_Utility { } public static void sendChatToPlayer(EntityPlayer aPlayer, String aChatMessage) { - if (aPlayer != null && aPlayer instanceof EntityPlayerMP && aChatMessage != null) { + if (aPlayer instanceof EntityPlayerMP && aChatMessage != null) { aPlayer.addChatComponentMessage(new ChatComponentText(aChatMessage)); } } @@ -509,7 +509,7 @@ public class GT_Utility { * @return the Amount of moved Items */ public static byte moveOneItemStack(Object aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - if (aTileEntity1 != null && aTileEntity1 instanceof IInventory) + if (aTileEntity1 instanceof IInventory) return moveOneItemStack((IInventory) aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, true); return 0; } @@ -606,7 +606,7 @@ public class GT_Utility { for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i; } - if (aTileEntity2 != null && aTileEntity2 instanceof IInventory) { + if (aTileEntity2 instanceof IInventory) { for (int i = 0; i < tGrabSlots.length; i++) { if (listContainsItem(aFilter, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]), true, aInvertFilter)) { if (isAllowedToTakeFromSlot((IInventory) aTileEntity1, tGrabSlots[i], aGrabFrom, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]))) { @@ -1019,7 +1019,7 @@ public class GT_Utility { } public static boolean isBlockValid(Object aBlock) { - return aBlock != null && (aBlock instanceof Block); + return (aBlock instanceof Block); } public static boolean isBlockInvalid(Object aBlock) { @@ -1035,7 +1035,7 @@ public class GT_Utility { } public static boolean isStackValid(Object aStack) { - return aStack != null && (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0; + return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0; } public static boolean isStackInvalid(Object aStack) { @@ -1560,15 +1560,17 @@ public class GT_Utility { } int tAmount = (int) (Math.pow(amount, 5) / 100); ChunkPosition tPos = new ChunkPosition(aX/16, 1, aZ/16); + int[] tInts = new int[2]; if(GT_Proxy.chunkData.containsKey(tPos)){ - int[] tInts = GT_Proxy.chunkData.get(tPos); + tInts = GT_Proxy.chunkData.get(tPos); if(tInts.length>0){ if(tInts[0]>=0){tAmount = tInts[0];} } GT_Proxy.chunkData.remove(tPos); } tAmount = tAmount - 5; - GT_Proxy.chunkData.put(tPos, new int[]{tAmount}); + tInts[0] = tAmount; + GT_Proxy.chunkData.put(tPos, tInts); return new FluidStack(tFluid, tAmount); } @@ -1583,7 +1585,7 @@ public class GT_Utility { Block tBlock = aWorld.getBlock(aX, aY, aZ); - tList.add("----- X: " +EnumChatFormatting.AQUA+ aX+EnumChatFormatting.RESET + " Y: " +EnumChatFormatting.AQUA+ aY +EnumChatFormatting.RESET+ " Z: " +EnumChatFormatting.AQUA+ aZ +EnumChatFormatting.RESET+ " -----"); + tList.add("----- X: " +EnumChatFormatting.AQUA+ aX +EnumChatFormatting.RESET + " Y: " +EnumChatFormatting.AQUA+ aY +EnumChatFormatting.RESET+ " Z: " +EnumChatFormatting.AQUA+ aZ +EnumChatFormatting.RESET+ " -----"); try { if (tTileEntity != null && tTileEntity instanceof IInventory) tList.add("Name: " + EnumChatFormatting.BLUE+ ((IInventory) tTileEntity).getInventoryName()+EnumChatFormatting.RESET + " MetaData: " +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ)+EnumChatFormatting.RESET); @@ -1689,7 +1691,7 @@ public class GT_Utility { rEUAmount += 400; int tValue = 0; if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress())) - tList.add("Progress: " +EnumChatFormatting.GREEN+GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()) +EnumChatFormatting.RESET+ " ticks / " +EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(tValue) +EnumChatFormatting.RESET+" ticks"); + tList.add("Progress: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()/20) +EnumChatFormatting.RESET+ " s / " +EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(tValue/20) +EnumChatFormatting.RESET+" s"); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index f6f6ac51ed..d956ccf35e 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -282,8 +282,7 @@ public class GT_Block_Machines public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && - ((tTileEntity instanceof IGregTechTileEntity))) { + if (((tTileEntity instanceof IGregTechTileEntity))) { ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer); } } @@ -341,7 +340,7 @@ public class GT_Block_Machines public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + if (((tTileEntity instanceof IGregTechTileEntity))) { return ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide); } return 0; @@ -352,7 +351,7 @@ public class GT_Block_Machines return 0; } TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + if (((tTileEntity instanceof IGregTechTileEntity))) { return ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); } return 0; @@ -363,7 +362,7 @@ public class GT_Block_Machines return 0; } TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + if (((tTileEntity instanceof IGregTechTileEntity))) { return ((IGregTechTileEntity) tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); } return 0; @@ -429,7 +428,7 @@ public class GT_Block_Machines public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, double explosionY, double explosionZ) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { + if (((tTileEntity instanceof IGregTechTileEntity))) { return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6); } return 10.0F; diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java index d5dc9a6d57..e69404f217 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java @@ -232,7 +232,7 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements public int getDamageValue(World aWorld, int aX, int aY, int aZ) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof GT_TileEntity_Ores))) { + if (((tTileEntity instanceof GT_TileEntity_Ores))) { return ((GT_TileEntity_Ores) tTileEntity).getMetaData(); } return 0; diff --git a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java index 6530ade4e1..814ab3f8fa 100644 --- a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java +++ b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java @@ -128,7 +128,7 @@ public class GT_Entity_Arrow if (tHitEntity != null) { tVector = new MovingObjectPosition(tHitEntity); } - if ((tVector != null) && (tVector.entityHit != null) && ((tVector.entityHit instanceof EntityPlayer))) { + if ((tVector != null) && ((tVector.entityHit instanceof EntityPlayer))) { EntityPlayer entityplayer = (EntityPlayer) tVector.entityHit; if ((entityplayer.capabilities.disableDamage) || (((tShootingEntity instanceof EntityPlayer)) && (!((EntityPlayer) tShootingEntity).canAttackPlayer(entityplayer)))) { tVector = null; diff --git a/src/main/java/gregtech/common/items/GT_SensorCard_Item.java b/src/main/java/gregtech/common/items/GT_SensorCard_Item.java index f10881d7f3..1c9daec46d 100644 --- a/src/main/java/gregtech/common/items/GT_SensorCard_Item.java +++ b/src/main/java/gregtech/common/items/GT_SensorCard_Item.java @@ -53,7 +53,7 @@ public class GT_SensorCard_Item ChunkCoordinates target = aCard.getTarget(); TileEntity tTileEntity = world.getTileEntity(target.posX, target.posY, target.posZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation) tTileEntity).isGivingInformation())) { + if (((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation) tTileEntity).isGivingInformation())) { String[] tInfoData = ((IGregTechDeviceInformation) tTileEntity).getInfoData(); for (int i = 0; i < tInfoData.length; i++) { aCard.setString("mString" + i, tInfoData[i]); diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java index d8c42232dd..f111e9f0fc 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Wrench.java @@ -40,7 +40,7 @@ public class Behaviour_Wrench byte aTargetSide = GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ); TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); try { - if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable))) { + if (((aTileEntity instanceof IWrenchable))) { if (((IWrenchable) aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) { if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { ((IWrenchable) aTileEntity).setFacing((short) aTargetSide); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java index c10efc717d..04014b5987 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -115,7 +115,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { this.mPumpCountBelow = 0; IGregTechTileEntity tTileEntity; for (int i = 1; (i < 21) && ((tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance((byte) 0, i)) != null) - && (tTileEntity.getMetaTileEntity() != null) && ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Pump)); i++) { + && ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Pump)); i++) { getBaseMetaTileEntity().setActive(tTileEntity.isActive()); this.mPumpCountBelow += 1; ((GT_MetaTileEntity_Pump) tTileEntity.getMetaTileEntity()).mPumpTimer -= 1; diff --git a/src/main/java/gregtech/loaders/load/GT_ItemIterator.java b/src/main/java/gregtech/loaders/load/GT_ItemIterator.java index 651b8e86d6..81847f2568 100644 --- a/src/main/java/gregtech/loaders/load/GT_ItemIterator.java +++ b/src/main/java/gregtech/loaders/load/GT_ItemIterator.java @@ -57,7 +57,7 @@ public class GT_ItemIterator Iterator tIterator = Item.itemRegistry.iterator(); while (tIterator.hasNext()) { Object tObject; - if (((tObject = tIterator.next()) != null) && ((tObject instanceof Item)) && (!(tObject instanceof GT_Generic_Item))) { + if (((tObject = tIterator.next()) instanceof Item) && (!(tObject instanceof GT_Generic_Item))) { Item tItem = (Item) tObject; String tName; if ((tName = tItem.getUnlocalizedName()) != null) { -- cgit From 4378d8c6732357c7f175c0990fbf7c461761bc9a Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sat, 13 Aug 2016 10:10:11 +0100 Subject: Try Catch Changes --- src/main/java/gregtech/GT_Mod.java | 93 ++-- .../java/gregtech/api/items/GT_MetaBase_Item.java | 80 ++-- .../api/metatileentity/BaseMetaPipeEntity.java | 196 +++++---- .../api/metatileentity/BaseMetaTileEntity.java | 476 ++++++++++----------- .../java/gregtech/api/objects/GT_FluidStack.java | 22 +- src/main/java/gregtech/api/util/GT_Utility.java | 8 +- src/main/java/gregtech/common/GT_Client.java | 10 +- src/main/java/gregtech/common/GT_Proxy.java | 32 +- .../java/gregtech/common/GT_Worldgenerator.java | 8 +- .../gregtech/common/blocks/GT_Block_Machines.java | 16 +- .../common/items/GT_IntegratedCircuit_Item.java | 8 +- .../common/items/behaviors/Behaviour_DataOrb.java | 2 +- .../gregtech/loaders/load/GT_ItemIterator.java | 340 +++++++-------- 13 files changed, 611 insertions(+), 680 deletions(-) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 4775792e50..60b8f32587 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -58,8 +58,7 @@ import java.util.*; import java.util.Map.Entry; @Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl; after:UndergroundBiomes;") -public class GT_Mod - implements IGT_Mod { +public class GT_Mod implements IGT_Mod { public static final int VERSION = 509; public static final int REQUIRED_IC2 = 624; @Mod.Instance("gregtech") @@ -104,13 +103,11 @@ public class GT_Mod if (GregTech_API.sPreloadStarted) { return; } - for (Runnable tRunnable : GregTech_API.sBeforeGTPreload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sBeforeGTPreload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} File tFile = new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "GregTech.cfg"); Configuration tMainConfig = new Configuration(tFile); tMainConfig.load(); @@ -367,13 +364,11 @@ public class GT_Mod GregTech_API.sPreloadFinished = true; GT_Log.out.println("GT_Mod: Preload-Phase finished!"); GT_Log.ore.println("GT_Mod: Preload-Phase finished!"); - for (Runnable tRunnable : GregTech_API.sAfterGTPreload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sAfterGTPreload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } @Mod.EventHandler @@ -381,13 +376,11 @@ public class GT_Mod if (GregTech_API.sLoadStarted) { return; } - for (Runnable tRunnable : GregTech_API.sBeforeGTLoad) { - try { + try { + for (Runnable tRunnable : GregTech_API.sBeforeGTLoad) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} new GT_Bees(); @@ -400,13 +393,11 @@ public class GT_Mod GregTech_API.sLoadFinished = true; GT_Log.out.println("GT_Mod: Load-Phase finished!"); GT_Log.ore.println("GT_Mod: Load-Phase finished!"); - for (Runnable tRunnable : GregTech_API.sAfterGTLoad) { - try { + try { + for (Runnable tRunnable : GregTech_API.sAfterGTLoad) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } @Mod.EventHandler @@ -414,13 +405,11 @@ public class GT_Mod if (GregTech_API.sPostloadStarted) { return; } - for (Runnable tRunnable : GregTech_API.sBeforeGTPostload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sBeforeGTPostload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} gregtechproxy.onPostLoad(); if (gregtechproxy.mSortToTheEnd) { gregtechproxy.registerUnificationEntries(); @@ -605,13 +594,11 @@ public class GT_Mod GregTech_API.sPostloadFinished = true; GT_Log.out.println("GT_Mod: PostLoad-Phase finished!"); GT_Log.ore.println("GT_Mod: PostLoad-Phase finished!"); - for (Runnable tRunnable : GregTech_API.sAfterGTPostload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sAfterGTPostload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} GT_Log.out.println("GT_Mod: Adding Fake Recipes for NEI"); if (ItemList.FR_Bee_Drone.get(1L, new Object[0]) != null) { GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.FR_Bee_Drone.getWildcard(1L, new Object[0])}, new ItemStack[]{ItemList.FR_Bee_Drone.getWithName(1L, "Scanned Drone", new Object[0])}, null, new FluidStack[]{Materials.Honey.getFluid(100L)}, null, 500, 2, 0); @@ -700,13 +687,11 @@ public class GT_Mod @Mod.EventHandler public void onServerStarting(FMLServerStartingEvent aEvent) { - for (Runnable tRunnable : GregTech_API.sBeforeGTServerstart) { - try { + try { + for (Runnable tRunnable : GregTech_API.sBeforeGTServerstart) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} gregtechproxy.onServerStarting(); GT_Log.out.println("GT_Mod: Unificating outputs of all known Recipe Types."); ArrayList tStacks = new ArrayList(10000); @@ -840,13 +825,11 @@ public class GT_Mod GregTech_API.mServerStarted = true; GT_Log.out.println("GT_Mod: ServerStarting-Phase finished!"); GT_Log.ore.println("GT_Mod: ServerStarting-Phase finished!"); - for (Runnable tRunnable : GregTech_API.sAfterGTServerstart) { - try { + try { + for (Runnable tRunnable : GregTech_API.sAfterGTServerstart) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } @Mod.EventHandler @@ -858,14 +841,12 @@ public class GT_Mod public void onIDChangingEvent(FMLModIdMappingEvent aEvent) { GT_Utility.reInit(); GT_Recipe.reInit(); - for (Iterator i$ = GregTech_API.sItemStackMappings.iterator(); i$.hasNext(); ) { - Map tMap = (Map) i$.next(); - try { + try { + for (Iterator i$ = GregTech_API.sItemStackMappings.iterator(); i$.hasNext(); ) { + Map tMap = (Map) i$.next(); GT_Utility.reMap(tMap); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } // public void onIDChangingEvent(FMLModIdMappingEvent aEvent) @@ -880,13 +861,11 @@ public class GT_Mod @Mod.EventHandler public void onServerStopping(FMLServerStoppingEvent aEvent) { - for (Runnable tRunnable : GregTech_API.sBeforeGTServerstop) { - try { + try { + for (Runnable tRunnable : GregTech_API.sBeforeGTServerstop) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} gregtechproxy.onServerStopping(); try { if ((GT_Values.D1) || (GT_Log.out != System.out)) { @@ -954,13 +933,11 @@ public class GT_Mod e.printStackTrace(GT_Log.err); } } - for (Runnable tRunnable : GregTech_API.sAfterGTServerstop) { - try { + try { + for (Runnable tRunnable : GregTech_API.sAfterGTServerstop) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } public boolean isServerSide() { diff --git a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java index c34f1a9c0c..6a93f6510c 100644 --- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java @@ -119,19 +119,18 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour tBehavior : tList) - try { - if (tBehavior.onLeftClickEntity(this, aStack, aPlayer, aEntity)) { - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); - return true; - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - return false; - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + try { if (tList != null) for (IItemBehaviour tBehavior : tList) + if (tBehavior.onLeftClickEntity(this, aStack, aPlayer, aEntity)) { + if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + return true; } + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + return false; + } + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } return false; } @@ -140,19 +139,18 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour tBehavior : tList) - try { - if (tBehavior.onItemUse(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); - return true; - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - return false; - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + try { if (tList != null) for (IItemBehaviour tBehavior : tList) + if (tBehavior.onItemUse(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { + if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + return true; + } + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + return false; } + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } return false; } @@ -161,19 +159,18 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour tBehavior : tList) - try { - if (tBehavior.onItemUseFirst(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); - return true; - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - return false; - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + try { if (tList != null) for (IItemBehaviour tBehavior : tList) + if (tBehavior.onItemUseFirst(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { + if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + return true; + } + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + return false; } + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } return false; } @@ -182,12 +179,11 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci use(aStack, 0, aPlayer); isItemStackUsable(aStack); ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour tBehavior : tList) - try { - aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer); - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } + try { if (tList != null) for (IItemBehaviour tBehavior : tList) + aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } return aStack; } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 5e6ddd77dc..8ec51e56b9 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -180,116 +180,114 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE long tTime = System.currentTimeMillis(); - for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) { - try { - switch (tCode) { - case 0: - tCode++; - if (mTickTimer++ == 0) { - oX = xCoord; - oY = yCoord; - oZ = zCoord; - if (isServerSide()) for (byte i = 0; i < 6; i++) - if (getCoverIDAtSide(i) != 0) - if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) - dropCover(i, i, true); - worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this); - mMetaTileEntity.onFirstTick(this); - if (!hasValidMetaTileEntity()) return; + try { for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) { + switch (tCode) { + case 0: + tCode++; + if (mTickTimer++ == 0) { + oX = xCoord; + oY = yCoord; + oZ = zCoord; + if (isServerSide()) for (byte i = 0; i < 6; i++) + if (getCoverIDAtSide(i) != 0) + if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) + dropCover(i, i, true); + worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this); + mMetaTileEntity.onFirstTick(this); + if (!hasValidMetaTileEntity()) return; + } + case 1: + tCode++; + if (isClientSide()) { + if (mColor != oColor) { + mMetaTileEntity.onColorChangeClient(oColor = mColor); + issueTextureUpdate(); } - case 1: - tCode++; - if (isClientSide()) { - if (mColor != oColor) { - mMetaTileEntity.onColorChangeClient(oColor = mColor); - issueTextureUpdate(); - } - if (mNeedsUpdate) { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - //worldObj.func_147479_m(xCoord, yCoord, zCoord); - mNeedsUpdate = false; - } + if (mNeedsUpdate) { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + //worldObj.func_147479_m(xCoord, yCoord, zCoord); + mNeedsUpdate = false; } - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - if (isServerSide() && mTickTimer > 10) { - for (byte i = (byte) (tCode - 2); i < 6; i++) - if (getCoverIDAtSide(i) != 0) { - tCode++; - GT_CoverBehavior tCover = getCoverBehaviorAtSide(i); - int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this); - if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) { - mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer); - if (!hasValidMetaTileEntity()) return; - } + } + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + if (isServerSide() && mTickTimer > 10) { + for (byte i = (byte) (tCode - 2); i < 6; i++) + if (getCoverIDAtSide(i) != 0) { + tCode++; + GT_CoverBehavior tCover = getCoverBehaviorAtSide(i); + int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this); + if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) { + mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer); + if (!hasValidMetaTileEntity()) return; } - mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~63)); - if ((mConnections & -64) == 64 && getRandomNumber(1000) == 0) { - mConnections = (byte) ((mConnections & ~64) | -128); } + mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~63)); + if ((mConnections & -64) == 64 && getRandomNumber(1000) == 0) { + mConnections = (byte) ((mConnections & ~64) | -128); + } + } + case 8: + tCode = 9; + mMetaTileEntity.onPreTick(this, mTickTimer); + if (!hasValidMetaTileEntity()) return; + case 9: + tCode++; + if (isServerSide()) { + if (mTickTimer == 10) { + for (byte i = 0; i < 6; i++) + mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); + issueBlockUpdate(); } - case 8: - tCode = 9; - mMetaTileEntity.onPreTick(this, mTickTimer); - if (!hasValidMetaTileEntity()) return; - case 9: - tCode++; - if (isServerSide()) { - if (mTickTimer == 10) { - for (byte i = 0; i < 6; i++) - mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); - issueBlockUpdate(); - } - if (xCoord != oX || yCoord != oY || zCoord != oZ) { - oX = xCoord; - oY = yCoord; - oZ = zCoord; - issueClientUpdate(); - clearTileEntityBuffer(); - } + if (xCoord != oX || yCoord != oY || zCoord != oZ) { + oX = xCoord; + oY = yCoord; + oZ = zCoord; + issueClientUpdate(); + clearTileEntityBuffer(); } - case 10: - tCode++; - mMetaTileEntity.onPostTick(this, mTickTimer); - if (!hasValidMetaTileEntity()) return; - case 11: - tCode++; - if (isServerSide()) { - if (mTickTimer % 10 == 0) { - if (mSendClientData) { - NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = mConnections, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord); - mSendClientData = false; - } + } + case 10: + tCode++; + mMetaTileEntity.onPostTick(this, mTickTimer); + if (!hasValidMetaTileEntity()) return; + case 11: + tCode++; + if (isServerSide()) { + if (mTickTimer % 10 == 0) { + if (mSendClientData) { + NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = mConnections, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord); + mSendClientData = false; } + } - if (mTickTimer > 10) { - if (mConnections != oTextureData) sendBlockEvent((byte) 0, oTextureData = mConnections); - byte tData = mMetaTileEntity.getUpdateData(); - if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData); - if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor); - tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)); - if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData); - } + if (mTickTimer > 10) { + if (mConnections != oTextureData) sendBlockEvent((byte) 0, oTextureData = mConnections); + byte tData = mMetaTileEntity.getUpdateData(); + if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData); + if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor); + tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)); + if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData); + } - if (mNeedsBlockUpdate) { - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0)); - mNeedsBlockUpdate = false; - } + if (mNeedsBlockUpdate) { + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0)); + mNeedsBlockUpdate = false; } - default: - tCode = -1; - break; - } - } catch (Throwable e) { - GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); + } + default: + tCode = -1; + break; } + }} catch (Throwable e) { + //GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); } if (isServerSide() && hasValidMetaTileEntity()) { @@ -706,7 +704,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE } @Override - public ITexture[] getTexture(Block aBlock, byte aSide) { + public ITexture[] getTexture(byte aSide) { ITexture rIcon = getCoverTexture(aSide); if (rIcon != null) return new ITexture[]{rIcon}; return getTextureUncovered(aSide); @@ -1313,4 +1311,4 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) { mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); } -} \ No newline at end of file +} diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 5902a70620..de81b09cec 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -252,289 +252,281 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE mRunningThroughTick = true; long tTime = System.currentTimeMillis(); - for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) { - try { - switch (tCode) { - case 0: - tCode++; - if (mTickTimer++ == 0) { - oX = xCoord; - oY = yCoord; - oZ = zCoord; - if (isServerSide()) for (byte i = 0; i < 6; i++) - if (getCoverIDAtSide(i) != 0) - if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) - dropCover(i, i, true); - - worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this); - - mMetaTileEntity.onFirstTick(this); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } + try { for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) { + switch (tCode) { + case 0: + tCode++; + if (mTickTimer++ == 0) { + oX = xCoord; + oY = yCoord; + oZ = zCoord; + if (isServerSide()) for (byte i = 0; i < 6; i++) + if (getCoverIDAtSide(i) != 0) + if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) + dropCover(i, i, true); + + worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this); + + mMetaTileEntity.onFirstTick(this); + if (!hasValidMetaTileEntity()) { + mRunningThroughTick = false; + return; + } + } + case 1: + tCode++; + if (isClientSide()) { + if (mColor != oColor) { + mMetaTileEntity.onColorChangeClient(oColor = mColor); + issueTextureUpdate(); } - case 1: - tCode++; - if (isClientSide()) { - if (mColor != oColor) { - mMetaTileEntity.onColorChangeClient(oColor = mColor); - issueTextureUpdate(); - } - if (mLightValue != oLightValueClient) { - worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1); - oLightValueClient = mLightValue; - issueTextureUpdate(); - } + if (mLightValue != oLightValueClient) { + worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1); + oLightValueClient = mLightValue; + issueTextureUpdate(); + } - if (mNeedsUpdate) { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - //worldObj.func_147479_m(xCoord, yCoord, zCoord); - mNeedsUpdate = false; - } + if (mNeedsUpdate) { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + //worldObj.func_147479_m(xCoord, yCoord, zCoord); + mNeedsUpdate = false; } - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - if (isServerSide() && mTickTimer > 10) { - for (byte i = (byte) (tCode - 2); i < 6; i++) - if (getCoverIDAtSide(i) != 0) { - tCode++; - GT_CoverBehavior tCover = getCoverBehaviorAtSide(i); - int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this); - if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) { - mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } + } + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + if (isServerSide() && mTickTimer > 10) { + for (byte i = (byte) (tCode - 2); i < 6; i++) + if (getCoverIDAtSide(i) != 0) { + tCode++; + GT_CoverBehavior tCover = getCoverBehaviorAtSide(i); + int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this); + if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) { + mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer); + if (!hasValidMetaTileEntity()) { + mRunningThroughTick = false; + return; } } + } + } + case 8: + tCode = 9; + if (isServerSide()) { + if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0; + if (++mAverageEUOutputIndex >= mAverageEUOutput.length) mAverageEUOutputIndex = 0; + + mAverageEUInput[mAverageEUInputIndex] = 0; + mAverageEUOutput[mAverageEUOutputIndex] = 0; + } + case 9: + tCode++; + mMetaTileEntity.onPreTick(this, mTickTimer); + if (!hasValidMetaTileEntity()) { + mRunningThroughTick = false; + return; + } + case 10: + tCode++; + if (isServerSide()) { + if (mRedstone != oRedstone || mTickTimer == 10) { + for (byte i = 0; i < 6; i++) + mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); + oRedstone = mRedstone; + issueBlockUpdate(); } - case 8: - tCode = 9; - if (isServerSide()) { - if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0; - if (++mAverageEUOutputIndex >= mAverageEUOutput.length) mAverageEUOutputIndex = 0; - - mAverageEUInput[mAverageEUInputIndex] = 0; - mAverageEUOutput[mAverageEUOutputIndex] = 0; + + if (xCoord != oX || yCoord != oY || zCoord != oZ) { + oX = xCoord; + oY = yCoord; + oZ = zCoord; + issueClientUpdate(); + clearTileEntityBuffer(); } - case 9: - tCode++; - mMetaTileEntity.onPreTick(this, mTickTimer); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; + + if (mFacing != oFacing) { + oFacing = mFacing; + for (byte i = 0; i < 6; i++) + if (getCoverIDAtSide(i) != 0) + if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) + dropCover(i, i, true); + issueBlockUpdate(); } - case 10: - tCode++; - if (isServerSide()) { - if (mRedstone != oRedstone || mTickTimer == 10) { - for (byte i = 0; i < 6; i++) - mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); - oRedstone = mRedstone; - issueBlockUpdate(); - } - if (xCoord != oX || yCoord != oY || zCoord != oZ) { - oX = xCoord; - oY = yCoord; - oZ = zCoord; - issueClientUpdate(); - clearTileEntityBuffer(); - } + if (mTickTimer > 20 && mMetaTileEntity.isElectric()) { + mAcceptedAmperes = 0; - if (mFacing != oFacing) { - oFacing = mFacing; - for (byte i = 0; i < 6; i++) - if (getCoverIDAtSide(i) != 0) - if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) - dropCover(i, i, true); - issueBlockUpdate(); + if (getOutputVoltage() != oOutput) { + oOutput = getOutputVoltage(); } - if (mTickTimer > 20 && mMetaTileEntity.isElectric()) { - mAcceptedAmperes = 0; - - if (getOutputVoltage() != oOutput) { - oOutput = getOutputVoltage(); - } - - if (mMetaTileEntity.isEnetOutput() || mMetaTileEntity.isEnetInput()) { - for (byte i = 0; i < 6; i++) { - boolean - temp = isEnergyInputSide(i); - if (temp != mActiveEUInputs[i]) { - mActiveEUInputs[i] = temp; - } - temp = isEnergyOutputSide(i); - if (temp != mActiveEUOutputs[i]) { - mActiveEUOutputs[i] = temp; - } + if (mMetaTileEntity.isEnetOutput() || mMetaTileEntity.isEnetInput()) { + for (byte i = 0; i < 6; i++) { + boolean + temp = isEnergyInputSide(i); + if (temp != mActiveEUInputs[i]) { + mActiveEUInputs[i] = temp; + } + temp = isEnergyOutputSide(i); + if (temp != mActiveEUOutputs[i]) { + mActiveEUOutputs[i] = temp; } } + } - if (mMetaTileEntity.isEnetOutput() && oOutput > 0) { - long tOutputVoltage = Math.max(oOutput, oOutput + (1 << GT_Utility.getTier(oOutput))), tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); - if (tUsableAmperage > 0) { - long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this); - mAverageEUOutput[mAverageEUOutputIndex] += tEU; - decreaseStoredEU(tEU, true); - } + if (mMetaTileEntity.isEnetOutput() && oOutput > 0) { + long tOutputVoltage = Math.max(oOutput, oOutput + (1 << GT_Utility.getTier(oOutput))), tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); + if (tUsableAmperage > 0) { + long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this); + mAverageEUOutput[mAverageEUOutputIndex] += tEU; + decreaseStoredEU(tEU, true); + } + } + if (getEUCapacity() > 0) { + if (GregTech_API.sMachineFireExplosions && getRandomNumber(1000) == 0) { + Block tBlock = getBlockAtSide((byte) getRandomNumber(6)); + if (tBlock instanceof BlockFire) doEnergyExplosion(); } - if (getEUCapacity() > 0) { - if (GregTech_API.sMachineFireExplosions && getRandomNumber(1000) == 0) { - Block tBlock = getBlockAtSide((byte) getRandomNumber(6)); - if (tBlock instanceof BlockFire) doEnergyExplosion(); - } - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } + if (!hasValidMetaTileEntity()) { + mRunningThroughTick = false; + return; + } - if (getRandomNumber(1000) == 0) { - if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord) - || (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord) - || (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord) - || (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord) - || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) { - if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) { - if (getRandomNumber(10) == 0) { - try { - GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); - } catch (Exception e) { - } - doEnergyExplosion(); - } else setOnFire(); - } - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) { + if (getRandomNumber(1000) == 0) { + if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord) + || (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord) + || (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord) + || (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord) + || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) { + if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) { + if (getRandomNumber(10) == 0) { try { GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); } catch (Exception e) { } doEnergyExplosion(); + } else setOnFire(); + } + if (!hasValidMetaTileEntity()) { + mRunningThroughTick = false; + return; + } + if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) { + try { + GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); + } catch (Exception e) { } + doEnergyExplosion(); } } } } + } - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } + if (!hasValidMetaTileEntity()) { + mRunningThroughTick = false; + return; } - case 11: - tCode++; - if (isServerSide()) { - if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) { - for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { - if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) { - dischargeItem(mMetaTileEntity.mInventory[i]); - if(ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i])>0){ - if((getStoredEU() + ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i])) 0 && getStoredEU() < getEUCapacity()) { + for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { + if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) { + dischargeItem(mMetaTileEntity.mInventory[i]); + if (mMetaTileEntity.mInventory[i].stackSize <= 0) + mMetaTileEntity.mInventory[i] = null; + mInventoryChanged = true; } } } - case 12: - tCode++; - if (isServerSide()) { - if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) { - for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { - if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) { - chargeItem(mMetaTileEntity.mInventory[i]); - if (mMetaTileEntity.mInventory[i].stackSize <= 0) - mMetaTileEntity.mInventory[i] = null; - mInventoryChanged = true; - } + } + case 12: + tCode++; + if (isServerSide()) { + if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) { + for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { + if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) { + chargeItem(mMetaTileEntity.mInventory[i]); + if (mMetaTileEntity.mInventory[i].stackSize <= 0) + mMetaTileEntity.mInventory[i] = null; + mInventoryChanged = true; } } } - case 13: - tCode++; - updateStatus(); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - case 14: - tCode++; - mMetaTileEntity.onPostTick(this, mTickTimer); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - case 15: - tCode++; - if (isServerSide()) { - if (mTickTimer % 10 == 0) { - if (mSendClientData) { - NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord); - mSendClientData = false; - } + } + case 13: + tCode++; + updateStatus(); + if (!hasValidMetaTileEntity()) { + mRunningThroughTick = false; + return; + } + case 14: + tCode++; + mMetaTileEntity.onPostTick(this, mTickTimer); + if (!hasValidMetaTileEntity()) { + mRunningThroughTick = false; + return; + } + case 15: + tCode++; + if (isServerSide()) { + if (mTickTimer % 10 == 0) { + if (mSendClientData) { + NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord); + mSendClientData = false; } + } - if (mTickTimer > 10) { - byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)); - if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData); - tData = mMetaTileEntity.getUpdateData(); - if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData); - if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor); - tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)); - if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData); - if (mLightValue != oLightValue) { - worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1); - issueTextureUpdate(); - sendBlockEvent((byte) 7, oLightValue = mLightValue); - } + if (mTickTimer > 10) { + byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)); + if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData); + tData = mMetaTileEntity.getUpdateData(); + if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData); + if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor); + tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)); + if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData); + if (mLightValue != oLightValue) { + worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1); + worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1); + issueTextureUpdate(); + sendBlockEvent((byte) 7, oLightValue = mLightValue); } + } - if (mNeedsBlockUpdate) { - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0)); - mNeedsBlockUpdate = false; - } + if (mNeedsBlockUpdate) { + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0)); + mNeedsBlockUpdate = false; } - default: - tCode = -1; - break; - } - } catch (Throwable e) { - GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); - } + } + default: + tCode = -1; + break; + }} + } catch (Throwable e) { + //gregtech.api.util.GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); } if (isServerSide() && hasValidMetaTileEntity()) { @@ -636,7 +628,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE public ArrayList getDebugInfo(EntityPlayer aPlayer, int aLogLevel) { ArrayList tList = new ArrayList(); if (aLogLevel > 2) { - tList.add("Meta-ID: " +EnumChatFormatting.BLUE+mID+EnumChatFormatting.RESET + (canAccessData() ? EnumChatFormatting.GREEN+" valid"+EnumChatFormatting.RESET : EnumChatFormatting.RED+" invalid"+EnumChatFormatting.RESET) + (mMetaTileEntity == null ? EnumChatFormatting.RED+" MetaTileEntity == null!"+EnumChatFormatting.RESET : " ")); + tList.add("Meta-ID: " +EnumChatFormatting.BLUE+ mID +EnumChatFormatting.RESET + (canAccessData() ? EnumChatFormatting.GREEN+" valid"+EnumChatFormatting.RESET : EnumChatFormatting.RED+" invalid"+EnumChatFormatting.RESET) + (mMetaTileEntity == null ? EnumChatFormatting.RED+" MetaTileEntity == null!"+EnumChatFormatting.RESET : " ")); } if (aLogLevel > 1) { if (mTimeStatistics.length > 0) { @@ -1842,4 +1834,4 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) { mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); } -} \ No newline at end of file +} diff --git a/src/main/java/gregtech/api/objects/GT_FluidStack.java b/src/main/java/gregtech/api/objects/GT_FluidStack.java index d2fdbbfb47..6ff1627ab7 100644 --- a/src/main/java/gregtech/api/objects/GT_FluidStack.java +++ b/src/main/java/gregtech/api/objects/GT_FluidStack.java @@ -30,27 +30,23 @@ public class GT_FluidStack extends FluidStack { } public static final synchronized void fixAllThoseFuckingFluidIDs() { - if (ForgeVersion.getBuildVersion() < 1355) { - while (lock) { - try { + if (ForgeVersion.getBuildVersion() < 1355 && ForgeVersion.getRevisionVersion() < 4) { + try { + while (lock) { Thread.sleep(1); - } catch (InterruptedException e) { - } - } + }} catch (InterruptedException e) {} lock = true; for (GT_FluidStack tFluid : sAllFluidStacks) tFluid.fixFluidIDForFucksSake(); - for (Map tMap : GregTech_API.sFluidMappings) - try { + try { + for (Map tMap : GregTech_API.sFluidMappings) GT_Utility.reMap(tMap); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} lock = false; } } public final void fixFluidIDForFucksSake() { - if (ForgeVersion.getBuildVersion() < 1355) { + if (ForgeVersion.getBuildVersion() < 1355 && ForgeVersion.getRevisionVersion() < 4) { int fluidID; try { fluidID = this.getFluid().getID(); @@ -67,7 +63,7 @@ public class GT_FluidStack extends FluidStack { @Override public FluidStack copy() { - if (ForgeVersion.getBuildVersion() < 1355) { + if (ForgeVersion.getBuildVersion() < 1355 && ForgeVersion.getRevisionVersion() < 4) { fixFluidIDForFucksSake(); } return new GT_FluidStack(this); diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index ee623725fd..cfd0b4b880 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -2011,16 +2011,14 @@ public class GT_Utility { if (aStack != null) { NBTTagList nbttaglist = aStack.getEnchantmentTagList(); if (nbttaglist != null) { - for (int i = 0; i < nbttaglist.tagCount(); ++i) { - try { + try { + for (int i = 0; i < nbttaglist.tagCount(); ++i) { short short1 = nbttaglist.getCompoundTagAt(i).getShort("id"); short short2 = nbttaglist.getCompoundTagAt(i).getShort("lvl"); if (Enchantment.enchantmentsList[short1] != null) aBullshitModifier.calculateModifier(Enchantment.enchantmentsList[short1], short2); - } catch (Throwable e) { - // } - } + } catch (Throwable e) {/**/} } } } diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index c96b63dbe6..2ed64941ac 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -204,9 +204,9 @@ public class GT_Client extends GT_Proxy public void onPostLoad() { super.onPostLoad(); - label0: - for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) - try { + try { + label0: + for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) do { if (i >= GregTech_API.METATILEENTITIES.length) continue label0; @@ -214,9 +214,7 @@ public class GT_Client extends GT_Proxy GregTech_API.METATILEENTITIES[i].getStackForm(1L).getTooltip(null, true); i++; } while (true); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} // super.onPostLoad(); diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index f242c318f6..96817f9201 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -483,17 +483,15 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } } GT_Log.out.println("GT_Mod: Adding Configs specific for MetaTileEntities"); - for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { - try { + try { + for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { for (; i < GregTech_API.METATILEENTITIES.length; i++) { if (GregTech_API.METATILEENTITIES[i] != null) { GregTech_API.METATILEENTITIES[i].onConfigLoad(GregTech_API.sMachineFile); } } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} GT_Log.out.println("GT_Mod: Adding Tool Usage Crafting Recipes for OreDict Items."); long tBits = GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.ONLY_ADD_IF_RESULT_IS_NOT_NULL | GT_ModHandler.RecipeBits.NOT_REMOVABLE; @@ -741,17 +739,15 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { break; } } - for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { - try { + try { + for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { for (; i < GregTech_API.METATILEENTITIES.length; i++) { if (GregTech_API.METATILEENTITIES[i] != null) { GregTech_API.METATILEENTITIES[i].onServerStart(); } } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } public void onServerStarted() { @@ -783,17 +779,15 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { File tSaveDirectory = getSaveDirectory(); GregTech_API.sWirelessRedstone.clear(); if (tSaveDirectory != null) { - for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { - try { + try { + for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { for (; i < GregTech_API.METATILEENTITIES.length; i++) { if (GregTech_API.METATILEENTITIES[i] != null) { GregTech_API.METATILEENTITIES[i].onWorldSave(tSaveDirectory); } } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } this.mUniverse = null; } @@ -1414,15 +1408,13 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { File tSaveDiretory = getSaveDirectory(); if (tSaveDiretory != null) { this.isFirstServerWorldTick = false; - for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) { - try { + try { + for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) { if (tMetaTileEntity != null) { tMetaTileEntity.onWorldLoad(tSaveDiretory); } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } } if ((aEvent.world.getTotalWorldTime() % 100L == 0L) && ((this.mItemDespawnTime != 6000) || (this.mMaxEqualEntitiesAtOneSpot > 0))) { diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index 9a5b2b3192..515a47c132 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -105,13 +105,11 @@ public class GT_Worldgenerator if (tBiome == null) { tBiome = BiomeGenBase.plains.biomeName; } - for (GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) { - try { + try { + for (GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) { tWorldGen.executeWorldgen(this.mWorld, this.mRandom, this.mBiome, this.mDimensionType, tX, tZ, this.mChunkGenerator, this.mChunkProvider); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} j++; } i++; diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index d956ccf35e..1ab5b2c500 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -212,15 +212,13 @@ public class GT_Block_Machines GregTech_API.sBlockIcons = aIconRegister; GT_Log.out.println("GT_Mod: Registering MetaTileEntity specific Textures"); - for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) { - try { + try { + for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) { if (tMetaTileEntity != null) { tMetaTileEntity.registerIcons(aIconRegister); } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} GT_Log.out.println("GT_Mod: Registering Crop specific Textures"); try { for (GT_BaseCrop tCrop : GT_BaseCrop.sCropList) { @@ -231,13 +229,11 @@ public class GT_Block_Machines } GT_Log.out.println("GT_Mod: Starting Block Icon Load Phase"); System.out.println("GT_Mod: Starting Block Icon Load Phase"); - for (Runnable tRunnable : GregTech_API.sGTBlockIconload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sGTBlockIconload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} GT_Log.out.println("GT_Mod: Finished Block Icon Load Phase"); System.out.println("GT_Mod: Finished Block Icon Load Phase"); } diff --git a/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java b/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java index 6f74c7b12d..179203feed 100644 --- a/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java +++ b/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java @@ -98,13 +98,11 @@ public class GT_IntegratedCircuit_Item GT_Log.out.println("GT_Mod: Starting Item Icon Load Phase"); System.out.println("GT_Mod: Starting Item Icon Load Phase"); GregTech_API.sItemIcons = aIconRegister; - for (Runnable tRunnable : GregTech_API.sGTItemIconload) { - try { + try { + for (Runnable tRunnable : GregTech_API.sGTItemIconload) { tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } - } + } catch (Throwable e) {e.printStackTrace(GT_Log.err);} GT_Log.out.println("GT_Mod: Finished Item Icon Load Phase"); System.out.println("GT_Mod: Finished Item Icon Load Phase"); } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java index 20a59b4023..0943a9b9e2 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataOrb.java @@ -94,7 +94,7 @@ public class Behaviour_DataOrb } public List getAdditionalToolTips(GT_MetaBase_Item aItem, List aList, ItemStack aStack) { - if (!getDataTitle(aStack).equals("")) { + if (!(getDataTitle(aStack).length() == 0)) { aList.add(getDataTitle(aStack)); aList.add(getDataName(aStack)); } diff --git a/src/main/java/gregtech/loaders/load/GT_ItemIterator.java b/src/main/java/gregtech/loaders/load/GT_ItemIterator.java index 81847f2568..acbd8ca95c 100644 --- a/src/main/java/gregtech/loaders/load/GT_ItemIterator.java +++ b/src/main/java/gregtech/loaders/load/GT_ItemIterator.java @@ -54,14 +54,14 @@ public class GT_ItemIterator GT_Log.out.println("GT_Mod: Scanning ItemList."); - Iterator tIterator = Item.itemRegistry.iterator(); - while (tIterator.hasNext()) { - Object tObject; - if (((tObject = tIterator.next()) instanceof Item) && (!(tObject instanceof GT_Generic_Item))) { - Item tItem = (Item) tObject; - String tName; - if ((tName = tItem.getUnlocalizedName()) != null) { - try { + try { + Iterator tIterator = Item.itemRegistry.iterator(); + while (tIterator.hasNext()) { + Object tObject; + if (((tObject = tIterator.next()) instanceof Item) && (!(tObject instanceof GT_Generic_Item))) { + Item tItem = (Item) tObject; + String tName; + if ((tName = tItem.getUnlocalizedName()) != null) { if ((tItem instanceof IToolCrowbar)) { if ((!tItem.isDamageable()) && (!GT_ModHandler.isElectricItem(new ItemStack(tItem, 1, 0)))) { if ((GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "infiniteDurabilityRCCrowbars", false)) && @@ -72,9 +72,6 @@ public class GT_ItemIterator GT_Log.out.println("GT_Mod: Registered valid RC Crowbar: " + tName); } } - } catch (Throwable e) { - } - try { if ((tItem instanceof IToolWrench)) { if ((!tItem.isDamageable()) && (!GT_ModHandler.isElectricItem(new ItemStack(tItem, 1, 0)))) { if ((GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "infiniteDurabilityBCWrenches", false)) && @@ -85,180 +82,175 @@ public class GT_ItemIterator GT_Log.out.println("GT_Mod: Registered valid BC Wrench: " + tName); } } - } catch (Throwable e) { - } - Block tBlock = GT_Utility.getBlockFromStack(new ItemStack(tItem, 1, 0)); - if (tBlock != null) { - if (tName.endsWith("beehives")) { - tBlock.setHarvestLevel("scoop", 0); - gregtech.common.tools.GT_Tool_Scoop.sBeeHiveMaterial = tBlock.getMaterial(); - } - if (OrePrefixes.stone.mDefaultStackSize < tItem.getItemStackLimit(new ItemStack(tItem, 1, 0))) { - try { + Block tBlock = GT_Utility.getBlockFromStack(new ItemStack(tItem, 1, 0)); + if (tBlock != null) { + if (tName.endsWith("beehives")) { + tBlock.setHarvestLevel("scoop", 0); + gregtech.common.tools.GT_Tool_Scoop.sBeeHiveMaterial = tBlock.getMaterial(); + } + if (OrePrefixes.stone.mDefaultStackSize < tItem.getItemStackLimit(new ItemStack(tItem, 1, 0))) { if ((tBlock.isReplaceableOreGen(GT_Values.DW, 0, 0, 0, Blocks.stone)) || (tBlock.isReplaceableOreGen(GT_Values.DW, 0, 0, 0, Blocks.netherrack)) || (tBlock.isReplaceableOreGen(GT_Values.DW, 0, 0, 0, Blocks.end_stone))) { tItem.setMaxStackSize(OrePrefixes.stone.mDefaultStackSize); } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); } } - } - if (((tItem instanceof ItemFood)) && (tItem != ItemList.IC2_Food_Can_Filled.getItem()) && (tItem != ItemList.IC2_Food_Can_Spoiled.getItem())) { - int tFoodValue = ((ItemFood) tItem).func_150905_g(new ItemStack(tItem, 1, 0)); - if (tFoodValue > 0) { - GT_Values.RA.addCannerRecipe(new ItemStack(tItem, 1, 32767), ItemList.IC2_Food_Can_Empty.get(tFoodValue, new Object[0]), ItemList.IC2_Food_Can_Filled.get(tFoodValue, new Object[0]), GT_Utility.getContainerItem(new ItemStack(tItem, 1, 0), true), tFoodValue * 100, 1); + if (((tItem instanceof ItemFood)) && (tItem != ItemList.IC2_Food_Can_Filled.getItem()) && (tItem != ItemList.IC2_Food_Can_Spoiled.getItem())) { + int tFoodValue = ((ItemFood) tItem).func_150905_g(new ItemStack(tItem, 1, 0)); + if (tFoodValue > 0) { + GT_Values.RA.addCannerRecipe(new ItemStack(tItem, 1, 32767), ItemList.IC2_Food_Can_Empty.get(tFoodValue, new Object[0]), ItemList.IC2_Food_Can_Filled.get(tFoodValue, new Object[0]), GT_Utility.getContainerItem(new ItemStack(tItem, 1, 0), true), tFoodValue * 100, 1); + } } - } - if ((tItem instanceof IFluidContainerItem)) { - GT_OreDictUnificator.addToBlacklist(new ItemStack(tItem, 1, 32767)); - } - if ((tName.equals("item.ItemSensorLocationCard")) || (tName.equals("item.ItemEnergySensorLocationCard")) || (tName.equals("item.ItemEnergyArrayLocationCard")) || (tName.equals("item.ItemTextCard"))) { - GT_Values.RA.addAssemblerRecipe(new ItemStack(tItem, 1, 32767), null, ItemList.Circuit_Basic.get(2L, new Object[0]), 200, 32); - } - if (tName.equals("item.ItemTimeCard")) { - GT_Values.RA.addAssemblerRecipe(new ItemStack(tItem, 1, 32767), null, ItemList.Circuit_Basic.get(1L, new Object[0]), 100, 32); - } - if (tName.equals("tile.ArsMagica:ore_vinteum")) { - GT_OreDictUnificator.set(OrePrefixes.ore, Materials.Vinteum, new ItemStack(tItem, 1, 0)); - } - if (tName.equals("item.ArsMagica:purified_vinteum")) { - GT_Values.RA.addFuel(new ItemStack(tItem, 1, 0), null, 256, 5); - } - if ((tName.equals("item.fieryBlood")) || (tName.equals("item.fieryTears"))) { - GT_Values.RA.addFuel(new ItemStack(tItem, 1, 0), null, 2048, 5); - } - if (tName.equals("tile.TFRoots")) { - GT_ModHandler.addPulverisationRecipe(new ItemStack(tItem, 1, 0), new ItemStack(Items.stick, 2), new ItemStack(Items.stick, 1), 30); - GT_ModHandler.addSawmillRecipe(new ItemStack(tItem, 1, 0), new ItemStack(Items.stick, 4), new ItemStack(Items.stick, 2)); - GT_Values.RA.addFuel(new ItemStack(tItem, 1, 1), new ItemStack(Items.stick, 4), 32, 5); - } - if (tName.equals("item.tconstruct.manual")) { - GT_OreDictUnificator.registerOre("bookTinkersManual", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ArsMagica:spell_parchment")) { - GT_OreDictUnificator.registerOre("paperArsSpellParchment", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ArsMagica:spell_recipe")) { - GT_OreDictUnificator.registerOre("paperArsSpellRecipe", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ArsMagica:spell_book")) { - GT_OreDictUnificator.registerOre("bookArsSpells", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.myst.page")) { - GT_OreDictUnificator.registerOre("paperMystcraft", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.myst.agebook")) { - GT_OreDictUnificator.registerOre("bookMystcraftAge", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.myst.linkbook")) { - GT_OreDictUnificator.registerOre("bookMystcraftLink", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.myst.notebook")) { - GT_OreDictUnificator.registerOre("bookNotes", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.itemManuelBook")) { - GT_OreDictUnificator.registerOre("bookWritten", new ItemStack(tItem, 1, 0)); - } - if (tName.equals("item.blueprintItem")) { - GT_OreDictUnificator.registerOre("paperBlueprint", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ccprintout")) { - GT_OreDictUnificator.registerOre("paperWritten", new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre("paperWritten", new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre("bookWritten", new ItemStack(tItem, 1, 2)); - } - if (tName.equals("item.blueprintItem")) { - GT_OreDictUnificator.registerOre("paperBlueprint", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.wirelessmap")) { - GT_OreDictUnificator.registerOre("paperMap", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ItemResearchNotes")) { - GT_OreDictUnificator.registerOre("paperResearch", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ItemThaumonomicon")) { - GT_OreDictUnificator.registerOre("bookThaumonomicon", new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("item.ligniteCoal")) { - GT_OreDictUnificator.set(OrePrefixes.gem, Materials.Lignite, new ItemStack(tItem, 1, 0)); - } - if ((tName.equals("tile.extrabiomes.redrock")) || (tName.equals("tile.bop.redRocks"))) { - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 2)); - } - if (tName.equals("tile.rpstone")) { - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 2)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 3)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 4)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 5)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 6)); - } - if (/**(tName.equals("tile.sedimentaryStone")) ||**/ ((tName.equals("tile.igneousStone")) || (tName.equals("tile.igneousStoneBrick")) || (tName.equals("tile.igneousCobblestone")))) { - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteRed, new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteBlack, new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Rhyolite, new ItemStack(tItem, 1, 2)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Andesite, new ItemStack(tItem, 1, 3)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gabbro, new ItemStack(tItem, 1, 4)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 5)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Komatiite, new ItemStack(tItem, 1, 6)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Dacite, new ItemStack(tItem, 1, 7)); + if ((tItem instanceof IFluidContainerItem)) { + GT_OreDictUnificator.addToBlacklist(new ItemStack(tItem, 1, 32767)); + } + if ((tName.equals("item.ItemSensorLocationCard")) || (tName.equals("item.ItemEnergySensorLocationCard")) || (tName.equals("item.ItemEnergyArrayLocationCard")) || (tName.equals("item.ItemTextCard"))) { + GT_Values.RA.addAssemblerRecipe(new ItemStack(tItem, 1, 32767), null, ItemList.Circuit_Basic.get(2L, new Object[0]), 200, 32); + } + if (tName.equals("item.ItemTimeCard")) { + GT_Values.RA.addAssemblerRecipe(new ItemStack(tItem, 1, 32767), null, ItemList.Circuit_Basic.get(1L, new Object[0]), 100, 32); + } + if (tName.equals("tile.ArsMagica:ore_vinteum")) { + GT_OreDictUnificator.set(OrePrefixes.ore, Materials.Vinteum, new ItemStack(tItem, 1, 0)); + } + if (tName.equals("item.ArsMagica:purified_vinteum")) { + GT_Values.RA.addFuel(new ItemStack(tItem, 1, 0), null, 256, 5); + } + if ((tName.equals("item.fieryBlood")) || (tName.equals("item.fieryTears"))) { + GT_Values.RA.addFuel(new ItemStack(tItem, 1, 0), null, 2048, 5); + } + if (tName.equals("tile.TFRoots")) { + GT_ModHandler.addPulverisationRecipe(new ItemStack(tItem, 1, 0), new ItemStack(Items.stick, 2), new ItemStack(Items.stick, 1), 30); + GT_ModHandler.addSawmillRecipe(new ItemStack(tItem, 1, 0), new ItemStack(Items.stick, 4), new ItemStack(Items.stick, 2)); + GT_Values.RA.addFuel(new ItemStack(tItem, 1, 1), new ItemStack(Items.stick, 4), 32, 5); + } + if (tName.equals("item.tconstruct.manual")) { + GT_OreDictUnificator.registerOre("bookTinkersManual", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ArsMagica:spell_parchment")) { + GT_OreDictUnificator.registerOre("paperArsSpellParchment", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ArsMagica:spell_recipe")) { + GT_OreDictUnificator.registerOre("paperArsSpellRecipe", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ArsMagica:spell_book")) { + GT_OreDictUnificator.registerOre("bookArsSpells", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.myst.page")) { + GT_OreDictUnificator.registerOre("paperMystcraft", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.myst.agebook")) { + GT_OreDictUnificator.registerOre("bookMystcraftAge", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.myst.linkbook")) { + GT_OreDictUnificator.registerOre("bookMystcraftLink", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.myst.notebook")) { + GT_OreDictUnificator.registerOre("bookNotes", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.itemManuelBook")) { + GT_OreDictUnificator.registerOre("bookWritten", new ItemStack(tItem, 1, 0)); + } + if (tName.equals("item.blueprintItem")) { + GT_OreDictUnificator.registerOre("paperBlueprint", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ccprintout")) { + GT_OreDictUnificator.registerOre("paperWritten", new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre("paperWritten", new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre("bookWritten", new ItemStack(tItem, 1, 2)); + } + if (tName.equals("item.blueprintItem")) { + GT_OreDictUnificator.registerOre("paperBlueprint", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.wirelessmap")) { + GT_OreDictUnificator.registerOre("paperMap", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ItemResearchNotes")) { + GT_OreDictUnificator.registerOre("paperResearch", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ItemThaumonomicon")) { + GT_OreDictUnificator.registerOre("bookThaumonomicon", new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("item.ligniteCoal")) { + GT_OreDictUnificator.set(OrePrefixes.gem, Materials.Lignite, new ItemStack(tItem, 1, 0)); + } + if ((tName.equals("tile.extrabiomes.redrock")) || (tName.equals("tile.bop.redRocks"))) { + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 2)); + } + if (tName.equals("tile.rpstone")) { + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 2)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 3)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 4)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 5)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 6)); + } + if (/**(tName.equals("tile.sedimentaryStone")) ||**/ ((tName.equals("tile.igneousStone")) || (tName.equals("tile.igneousStoneBrick")) || (tName.equals("tile.igneousCobblestone")))) { + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteRed, new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteBlack, new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Rhyolite, new ItemStack(tItem, 1, 2)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Andesite, new ItemStack(tItem, 1, 3)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gabbro, new ItemStack(tItem, 1, 4)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 5)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Komatiite, new ItemStack(tItem, 1, 6)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Dacite, new ItemStack(tItem, 1, 7)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteRed, new ItemStack(tItem, 1, 8)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteBlack, new ItemStack(tItem, 1, 9)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Rhyolite, new ItemStack(tItem, 1, 10)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Andesite, new ItemStack(tItem, 1, 11)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gabbro, new ItemStack(tItem, 1, 12)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 13)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Komatiite, new ItemStack(tItem, 1, 14)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Dacite, new ItemStack(tItem, 1, 15)); - } - if ((tName.equals("tile.metamorphicStone")) || (tName.equals("tile.metamorphicStoneBrick")) || (tName.equals("tile.metamorphicCobblestone"))) { - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gneiss, new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Eclogite, new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 2)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Quartzite, new ItemStack(tItem, 1, 3)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Blueschist, new ItemStack(tItem, 1, 4)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Greenschist, new ItemStack(tItem, 1, 5)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Soapstone, new ItemStack(tItem, 1, 6)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Migmatite, new ItemStack(tItem, 1, 7)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteRed, new ItemStack(tItem, 1, 8)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.GraniteBlack, new ItemStack(tItem, 1, 9)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Rhyolite, new ItemStack(tItem, 1, 10)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Andesite, new ItemStack(tItem, 1, 11)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gabbro, new ItemStack(tItem, 1, 12)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, new ItemStack(tItem, 1, 13)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Komatiite, new ItemStack(tItem, 1, 14)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Dacite, new ItemStack(tItem, 1, 15)); + } + if ((tName.equals("tile.metamorphicStone")) || (tName.equals("tile.metamorphicStoneBrick")) || (tName.equals("tile.metamorphicCobblestone"))) { + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gneiss, new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Eclogite, new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 2)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Quartzite, new ItemStack(tItem, 1, 3)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Blueschist, new ItemStack(tItem, 1, 4)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Greenschist, new ItemStack(tItem, 1, 5)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Soapstone, new ItemStack(tItem, 1, 6)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Migmatite, new ItemStack(tItem, 1, 7)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gneiss, new ItemStack(tItem, 1, 8)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Eclogite, new ItemStack(tItem, 1, 9)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 10)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Quartzite, new ItemStack(tItem, 1, 11)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Blueschist, new ItemStack(tItem, 1, 12)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Greenschist, new ItemStack(tItem, 1, 13)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Soapstone, new ItemStack(tItem, 1, 14)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Migmatite, new ItemStack(tItem, 1, 15)); - } - if (tName.equals("tile.blockCosmeticSolid")) { - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Obsidian, new ItemStack(tItem, 1, 0)); - GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Obsidian, new ItemStack(tItem, 1, 1)); - GT_OreDictUnificator.registerOre(OrePrefixes.block, Materials.Thaumium, new ItemStack(tItem, 1, 4)); - } - if (tName.equals("tile.enderchest")) { - GT_OreDictUnificator.registerOre(OreDictNames.enderChest, new ItemStack(tItem, 1, 32767)); - } - if (tName.equals("tile.autoWorkbenchBlock")) { - GT_OreDictUnificator.registerOre(OreDictNames.craftingWorkBench, new ItemStack(tItem, 1, 0)); - } - if (tName.equals("tile.pumpBlock")) { - GT_OreDictUnificator.registerOre(OreDictNames.craftingPump, new ItemStack(tItem, 1, 0)); - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "BCPump", false)) { - GT_ModHandler.removeRecipeByOutput(new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Gneiss, new ItemStack(tItem, 1, 8)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Eclogite, new ItemStack(tItem, 1, 9)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, new ItemStack(tItem, 1, 10)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Quartzite, new ItemStack(tItem, 1, 11)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Blueschist, new ItemStack(tItem, 1, 12)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Greenschist, new ItemStack(tItem, 1, 13)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Soapstone, new ItemStack(tItem, 1, 14)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Migmatite, new ItemStack(tItem, 1, 15)); + } + if (tName.equals("tile.blockCosmeticSolid")) { + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Obsidian, new ItemStack(tItem, 1, 0)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Obsidian, new ItemStack(tItem, 1, 1)); + GT_OreDictUnificator.registerOre(OrePrefixes.block, Materials.Thaumium, new ItemStack(tItem, 1, 4)); + } + if (tName.equals("tile.enderchest")) { + GT_OreDictUnificator.registerOre(OreDictNames.enderChest, new ItemStack(tItem, 1, 32767)); + } + if (tName.equals("tile.autoWorkbenchBlock")) { + GT_OreDictUnificator.registerOre(OreDictNames.craftingWorkBench, new ItemStack(tItem, 1, 0)); + } + if (tName.equals("tile.pumpBlock")) { + GT_OreDictUnificator.registerOre(OreDictNames.craftingPump, new ItemStack(tItem, 1, 0)); + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "BCPump", false)) { + GT_ModHandler.removeRecipeByOutput(new ItemStack(tItem, 1, 0)); + } + } + if (tName.equals("tile.tankBlock")) { + GT_OreDictUnificator.registerOre(OreDictNames.craftingTank, new ItemStack(tItem, 1, 0)); + } + if (tName.equals("item.drawplateDiamond")) { + GT_OreDictUnificator.registerOre(ToolDictNames.craftingToolDrawplate, new ItemStack(tItem, 1, 32767)); } - } - if (tName.equals("tile.tankBlock")) { - GT_OreDictUnificator.registerOre(OreDictNames.craftingTank, new ItemStack(tItem, 1, 0)); - } - if (tName.equals("item.drawplateDiamond")) { - GT_OreDictUnificator.registerOre(ToolDictNames.craftingToolDrawplate, new ItemStack(tItem, 1, 32767)); } } } - } + } catch (Throwable e) {/**/} } } -- cgit