Fix Tools and lag on reading tooltip

This commit is contained in:
Blood-Asp 2016-09-15 22:02:18 +02:00
parent c997df5952
commit 0e60389c41
4 changed files with 35 additions and 38 deletions

View file

@ -8,26 +8,26 @@ import java.util.*;
public class GT_HashSet<E extends GT_ItemStack> extends AbstractSet<E> {
private static final Object OBJECT = new Object();
private transient Map<GT_ItemStack, Object> map;
private transient HashMap<GT_ItemStack, Object> map;
public GT_HashSet() {
map = new WeakHashMap<GT_ItemStack, Object>();
map = new HashMap<GT_ItemStack, Object>();
GregTech_API.sItemStackMappings.add(map);
}
public GT_HashSet(Collection<? extends E> c) {
map = new WeakHashMap<GT_ItemStack, Object>(Math.max((int) (c.size() / .75f) + 1, 16));
map = new HashMap<GT_ItemStack, Object>(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<GT_ItemStack, Object>(initialCapacity, loadFactor);
map = new HashMap<GT_ItemStack, Object>(initialCapacity, loadFactor);
GregTech_API.sItemStackMappings.add(map);
}
public GT_HashSet(int initialCapacity) {
map = new WeakHashMap<GT_ItemStack, Object>(initialCapacity);
map = new HashMap<GT_ItemStack, Object>(initialCapacity);
GregTech_API.sItemStackMappings.add(map);
}
@ -36,7 +36,7 @@ public class GT_HashSet<E extends GT_ItemStack> extends AbstractSet<E> {
GregTech_API.sItemStackMappings.add(map);
}
public final Map getMap() {
public HashMap getMap() {
return map;
}

View file

@ -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;
}

View file

@ -192,27 +192,20 @@ public class GT_ThaumcraftCompat
}
public boolean registerThaumcraftAspectsToItem(ItemStack aExampleStack, List<TC_Aspects.TC_AspectStack> aAspects, String aOreDict) {
if (aAspects.isEmpty()) {
return false;
}
AspectList tAlreadyRegisteredAspects = ThaumcraftApiHelper.getObjectAspects(aExampleStack);
if ((tAlreadyRegisteredAspects == null) || (tAlreadyRegisteredAspects.size() <= 0)) {
ThaumcraftApi.registerObjectTag(aOreDict, getAspectList(aAspects));
}
if (aAspects.isEmpty()) return false;
ThaumcraftApi.registerObjectTag(aOreDict, (AspectList)getAspectList(aAspects));
return true;
}
public boolean registerThaumcraftAspectsToItem(ItemStack aStack, List<TC_Aspects.TC_AspectStack> aAspects, boolean aAdditive) {
if (aAspects.isEmpty()) {
return false;
}
if (aAspects.isEmpty()) return false;
if (aAdditive) {
ThaumcraftApi.registerComplexObjectTag(aStack, getAspectList(aAspects));
ThaumcraftApi.registerComplexObjectTag(aStack, (AspectList)getAspectList(aAspects));
return true;
}
AspectList tAlreadyRegisteredAspects = ThaumcraftApiHelper.getObjectAspects(aStack);
if ((tAlreadyRegisteredAspects == null) || (tAlreadyRegisteredAspects.size() <= 0)) {
ThaumcraftApi.registerObjectTag(aStack, getAspectList(aAspects));
if (tAlreadyRegisteredAspects == null || tAlreadyRegisteredAspects.size() <= 0) {
ThaumcraftApi.registerObjectTag(aStack, (AspectList)getAspectList(aAspects));
}
return true;
}

View file

@ -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) {