From 0e60389c4114c7ea5bd3b9688b6b659aae8aaa53 Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Thu, 15 Sep 2016 22:02:18 +0200 Subject: [PATCH] Fix Tools and lag on reading tooltip --- .../java/gregtech/api/objects/GT_HashSet.java | 12 +++--- .../java/gregtech/common/GT_RecipeAdder.java | 4 ++ .../gregtech/common/GT_ThaumcraftCompat.java | 41 ++++++++----------- .../common/blocks/GT_Item_Machines.java | 16 ++++---- 4 files changed, 35 insertions(+), 38 deletions(-) diff --git a/src/main/java/gregtech/api/objects/GT_HashSet.java b/src/main/java/gregtech/api/objects/GT_HashSet.java index 32d8319c..cec00690 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 Map map; + private transient HashMap map; public GT_HashSet() { - map = new WeakHashMap(); + map = new HashMap(); GregTech_API.sItemStackMappings.add(map); } public GT_HashSet(Collection c) { - map = new WeakHashMap(Math.max((int) (c.size() / .75f) + 1, 16)); + map = new HashMap(Math.max((int) (c.size() / .75f) + 1, 16)); addAll(c); GregTech_API.sItemStackMappings.add(map); } public GT_HashSet(int initialCapacity, float loadFactor) { - map = new WeakHashMap(initialCapacity, loadFactor); + map = new HashMap(initialCapacity, loadFactor); GregTech_API.sItemStackMappings.add(map); } public GT_HashSet(int initialCapacity) { - map = new WeakHashMap(initialCapacity); + map = new HashMap(initialCapacity); GregTech_API.sItemStackMappings.add(map); } @@ -36,7 +36,7 @@ public class GT_HashSet extends AbstractSet { GregTech_API.sItemStackMappings.add(map); } - public final Map getMap() { + public HashMap getMap() { return map; } diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index 2030d12c..01032674 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -16,6 +16,7 @@ import net.minecraftforge.fluids.FluidStack; public class GT_RecipeAdder implements IGT_RecipeAdder { + @Deprecated public boolean addFusionReactorRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt, int aStartEU) { return false; } @@ -25,6 +26,9 @@ public class GT_RecipeAdder if (aInput1 == null || aInput2 == null || aOutput1 == null || aDuration < 1 || aEUt < 1 || aStartEU < 1) { return false; } + if ((aOutput1 != null) && ((aDuration = GregTech_API.sRecipeFile.get("fusion", aOutput1.getFluid().getName(), aDuration)) <= 0)) { + return false; + } GT_Recipe.GT_Recipe_Map.sFusionRecipes.addRecipe(null, new FluidStack[]{aInput1, aInput2}, new FluidStack[]{aOutput1}, aDuration, aEUt, aStartEU); return true; } diff --git a/src/main/java/gregtech/common/GT_ThaumcraftCompat.java b/src/main/java/gregtech/common/GT_ThaumcraftCompat.java index 7c2cfed0..aa3d1203 100644 --- a/src/main/java/gregtech/common/GT_ThaumcraftCompat.java +++ b/src/main/java/gregtech/common/GT_ThaumcraftCompat.java @@ -191,31 +191,24 @@ public class GT_ThaumcraftCompat return ThaumcraftApi.addInfusionCraftingRecipe(aResearch, GT_Utility.copy(new Object[]{aOutput}), aInstability, getAspectList(aAspects), aMainInput, aSideInputs); } - public boolean registerThaumcraftAspectsToItem(ItemStack aExampleStack, List aAspects, String aOreDict) { - if (aAspects.isEmpty()) { - return false; - } - AspectList tAlreadyRegisteredAspects = ThaumcraftApiHelper.getObjectAspects(aExampleStack); - if ((tAlreadyRegisteredAspects == null) || (tAlreadyRegisteredAspects.size() <= 0)) { - ThaumcraftApi.registerObjectTag(aOreDict, getAspectList(aAspects)); - } - return true; - } + public boolean registerThaumcraftAspectsToItem(ItemStack aExampleStack, List aAspects, String aOreDict) { + if (aAspects.isEmpty()) return false; + ThaumcraftApi.registerObjectTag(aOreDict, (AspectList)getAspectList(aAspects)); + return true; + } - public boolean registerThaumcraftAspectsToItem(ItemStack aStack, List aAspects, boolean aAdditive) { - if (aAspects.isEmpty()) { - return false; - } - if (aAdditive) { - ThaumcraftApi.registerComplexObjectTag(aStack, getAspectList(aAspects)); - return true; - } - AspectList tAlreadyRegisteredAspects = ThaumcraftApiHelper.getObjectAspects(aStack); - if ((tAlreadyRegisteredAspects == null) || (tAlreadyRegisteredAspects.size() <= 0)) { - ThaumcraftApi.registerObjectTag(aStack, getAspectList(aAspects)); - } - return true; - } + public boolean registerThaumcraftAspectsToItem(ItemStack aStack, List aAspects, boolean aAdditive) { + if (aAspects.isEmpty()) return false; + if (aAdditive) { + ThaumcraftApi.registerComplexObjectTag(aStack, (AspectList)getAspectList(aAspects)); + return true; + } + AspectList tAlreadyRegisteredAspects = ThaumcraftApiHelper.getObjectAspects(aStack); + if (tAlreadyRegisteredAspects == null || tAlreadyRegisteredAspects.size() <= 0) { + ThaumcraftApi.registerObjectTag(aStack, (AspectList)getAspectList(aAspects)); + } + return true; + } public boolean registerPortholeBlacklistedBlock(Block aBlock) { ThaumcraftApi.portableHoleBlackList.add(aBlock); diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java index 12b7782d..dd77d4e7 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java @@ -50,21 +50,21 @@ public class GT_Item_Machines int i = 0; for (String tDescription : tTileEntity.getDescription()) { if (GT_Utility.isStringValid(tDescription)) { - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription )); + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished )); } } } if (tTileEntity.getEUCapacity() > 0L) { if (tTileEntity.getInputVoltage() > 0L) { - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: " ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")" + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")" + EnumChatFormatting.GRAY); } if (tTileEntity.getOutputVoltage() > 0L) { - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: " ) + EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] + ")" + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] + ")" + EnumChatFormatting.GRAY); } if (tTileEntity.getOutputAmperage() > 1L) { - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: " ) + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY); } - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: " ) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY); } } } @@ -72,14 +72,14 @@ public class GT_Item_Machines NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { if (aNBT.getBoolean("mMuffler")) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade" )); + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished )); } if (aNBT.getBoolean("mSteamConverter")) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade" )); + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished )); } int tAmount = 0; if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) { - aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades" )); + aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished )); } } } catch (Throwable e) {