diff options
Diffstat (limited to 'src/main/java/gregtech/api/util')
47 files changed, 10868 insertions, 5173 deletions
diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSection.java b/src/main/java/gregtech/api/util/ColorsMetadataSection.java index 2851435061..9f1c4f3ffe 100644 --- a/src/main/java/gregtech/api/util/ColorsMetadataSection.java +++ b/src/main/java/gregtech/api/util/ColorsMetadataSection.java @@ -2,10 +2,8 @@ package gregtech.api.util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.Map; import java.util.HashMap; -import gregtech.api.util.GT_Log; -import gregtech.api.GregTech_API; +import java.util.Map; import net.minecraft.client.resources.data.IMetadataSection; @SideOnly(Side.CLIENT) @@ -16,7 +14,8 @@ public class ColorsMetadataSection implements IMetadataSection { private final Map<String, String> hexGuiTints; private final boolean guiTintEnabled; - public ColorsMetadataSection(Map<String, String> hexTextColorMap, Map<String, String> hexGuiTintMap, boolean guiTintEnabled) { + public ColorsMetadataSection( + Map<String, String> hexTextColorMap, Map<String, String> hexGuiTintMap, boolean guiTintEnabled) { this.hexTextColors = hexTextColorMap; this.textColors = convertHexMapToIntMap(hexTextColorMap); @@ -26,16 +25,15 @@ public class ColorsMetadataSection implements IMetadataSection { this.guiTintEnabled = guiTintEnabled; } - private Map<String, Integer> convertHexMapToIntMap(Map <String, String> hexMap) { + private Map<String, Integer> convertHexMapToIntMap(Map<String, String> hexMap) { Map<String, Integer> intMap = new HashMap<>(); for (String key : hexMap.keySet()) { int colorValue = -1; String hex = hexMap.get(key); try { - if (!hex.isEmpty()) colorValue = Integer.parseUnsignedInt(hex,16); - } - catch (final NumberFormatException e) { + if (!hex.isEmpty()) colorValue = Integer.parseUnsignedInt(hex, 16); + } catch (final NumberFormatException e) { GT_Log.err.println("Couldn't format color correctly of " + key + " -> " + hex); } intMap.put(key, colorValue); @@ -51,7 +49,7 @@ public class ColorsMetadataSection implements IMetadataSection { return sColorInMap(key, this.hexGuiTints) ? defaultColor : this.guiTints.get(key); } - private boolean sColorInMap(String key, Map<String,String> hexMap) { + private boolean sColorInMap(String key, Map<String, String> hexMap) { return hexMap.containsKey(key) && hexMap.get(key).isEmpty(); } diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java index 4de8463685..718ff81854 100644 --- a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java +++ b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java @@ -7,26 +7,29 @@ import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.lang.reflect.Type; -import java.util.Map; -import java.util.HashMap; import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; -import net.minecraft.util.JsonUtils; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.Map; import net.minecraft.client.resources.data.BaseMetadataSectionSerializer; +import net.minecraft.util.JsonUtils; @SideOnly(Side.CLIENT) public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializer implements JsonSerializer { - public ColorsMetadataSection deserialize(JsonElement metadataColors, Type type, JsonDeserializationContext context) { + public ColorsMetadataSection deserialize( + JsonElement metadataColors, Type type, JsonDeserializationContext context) { // Default values boolean enableGuiTint = GregTech_API.sColoredGUI; Map<String, String> hexGuiTintMap = new HashMap<String, String>(); - Map<String, String> hexTextColorMap = new HashMap<String, String>() {{ - put("title", ""); - put("text", ""); - put("value", ""); - put("nei", ""); - }}; + Map<String, String> hexTextColorMap = new HashMap<String, String>() { + { + put("title", ""); + put("text", ""); + put("value", ""); + put("nei", ""); + } + }; JsonObject jsonObject = JsonUtils.getJsonElementAsJsonObject(metadataColors, "metadata section"); if (jsonObject.has("textColor")) { @@ -38,7 +41,8 @@ public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializ if (jsonObject.has("guiTint")) { JsonObject guiTints = JsonUtils.func_152754_s(jsonObject, "guiTint"); - enableGuiTint = JsonUtils.getJsonObjectBooleanFieldValueOrDefault(guiTints, "enableGuiTintWhenPainted", true); + enableGuiTint = + JsonUtils.getJsonObjectBooleanFieldValueOrDefault(guiTints, "enableGuiTintWhenPainted", true); for (Dyes dye : Dyes.values()) { hexGuiTintMap.put(dye.mName, GT_Util.toHexString(dye.getRGBA())); @@ -46,7 +50,9 @@ public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializ for (String key : hexGuiTintMap.keySet()) { if (enableGuiTint) { - hexGuiTintMap.replace(key, JsonUtils.getJsonObjectStringFieldValueOrDefault(guiTints, key, hexGuiTintMap.get(key))); + hexGuiTintMap.replace( + key, + JsonUtils.getJsonObjectStringFieldValueOrDefault(guiTints, key, hexGuiTintMap.get(key))); } else { hexGuiTintMap.replace(key, GT_Util.toHexString(Dyes.dyeWhite.getRGBA())); } diff --git a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java index e74b68111a..4cbd014cbc 100644 --- a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java +++ b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java @@ -3,13 +3,12 @@ package gregtech.api.util; import cpw.mods.fml.common.Loader; import gregtech.api.enums.OrePrefixes; import gregtech.common.items.GT_MetaGenerated_Item_03; +import java.util.*; +import java.util.function.Consumer; import net.bdew.gendustry.api.ApiaryModifiers; import net.bdew.gendustry.api.items.IApiaryUpgrade; import net.minecraft.item.ItemStack; -import java.util.*; -import java.util.function.Consumer; - public enum GT_ApiaryUpgrade { speed1(UNIQUE_INDEX.SPEED_UPGRADE, 32200, 1, 1), speed2(UNIQUE_INDEX.SPEED_UPGRADE, 32201, 1, 2), @@ -22,15 +21,17 @@ public enum GT_ApiaryUpgrade { speed8upgraded(UNIQUE_INDEX.SPEED_UPGRADE, 32208, 1, 8), ; - private enum UNIQUE_INDEX{ + private enum UNIQUE_INDEX { SPEED_UPGRADE, ; - void apply(Consumer<GT_ApiaryUpgrade> fn){ + + void apply(Consumer<GT_ApiaryUpgrade> fn) { UNIQUE_UPGRADE_LIST.get(this).forEach(fn); } } - private static final EnumMap<UNIQUE_INDEX, ArrayList<GT_ApiaryUpgrade>> UNIQUE_UPGRADE_LIST = new EnumMap<>(UNIQUE_INDEX.class); + private static final EnumMap<UNIQUE_INDEX, ArrayList<GT_ApiaryUpgrade>> UNIQUE_UPGRADE_LIST = + new EnumMap<>(UNIQUE_INDEX.class); private int meta = 0; private int maxnumber = 1; @@ -40,9 +41,10 @@ public enum GT_ApiaryUpgrade { private final UNIQUE_INDEX unique_index; private final HashMap<GT_Utility.ItemId, ItemStack> additionalGendustryUpgrades = new HashMap<>(); - private final HashSet<GT_Utility.ItemId> blacklistedUpgrades = new HashSet<>(); // additionalGendustryUpgrades are blacklisted by default + private final HashSet<GT_Utility.ItemId> blacklistedUpgrades = + new HashSet<>(); // additionalGendustryUpgrades are blacklisted by default - GT_ApiaryUpgrade(UNIQUE_INDEX unique_index, int meta, int maxnumber, int maxspeedmodifier){ + GT_ApiaryUpgrade(UNIQUE_INDEX unique_index, int meta, int maxnumber, int maxspeedmodifier) { this.unique_index = unique_index; this.meta = meta; this.maxnumber = maxnumber; @@ -50,11 +52,14 @@ public enum GT_ApiaryUpgrade { this.id = GT_Utility.ItemId.createNoCopy(get(1)); } - private void setup_static_variables(){ + private void setup_static_variables() { quickLookup.put(this.meta, this); ArrayList<GT_ApiaryUpgrade> un = UNIQUE_UPGRADE_LIST.get(this.unique_index); - if(un != null) - un.forEach((u) -> { u.blacklistedUpgrades.add(this.id); this.blacklistedUpgrades.add(u.id); }); + if (un != null) + un.forEach((u) -> { + u.blacklistedUpgrades.add(this.id); + this.blacklistedUpgrades.add(u.id); + }); else { un = new ArrayList<>(1); UNIQUE_UPGRADE_LIST.put(this.unique_index, un); @@ -62,45 +67,43 @@ public enum GT_ApiaryUpgrade { un.add(this); } - public static GT_ApiaryUpgrade getUpgrade(ItemStack s){ - if(s == null) - return null; - if(!isUpgrade(s)) - return null; + public static GT_ApiaryUpgrade getUpgrade(ItemStack s) { + if (s == null) return null; + if (!isUpgrade(s)) return null; return quickLookup.get(s.getItemDamage()); } - public boolean isAllowedToWorkWith(ItemStack s){ + public boolean isAllowedToWorkWith(ItemStack s) { GT_Utility.ItemId id = GT_Utility.ItemId.createNoCopy(s); return !additionalGendustryUpgrades.containsKey(id) && !blacklistedUpgrades.contains(id); } - public int getMaxNumber(){ + public int getMaxNumber() { return maxnumber; } - public void applyModifiers(ApiaryModifiers mods, ItemStack s){ - additionalGendustryUpgrades.forEach((k, u) -> ((IApiaryUpgrade)u.getItem()).applyModifiers(mods, u)); + public void applyModifiers(ApiaryModifiers mods, ItemStack s) { + additionalGendustryUpgrades.forEach((k, u) -> ((IApiaryUpgrade) u.getItem()).applyModifiers(mods, u)); } - public ItemStack get(int count){ + public ItemStack get(int count) { return new ItemStack(GT_MetaGenerated_Item_03.INSTANCE, count, meta); } - public static boolean isUpgrade(ItemStack s){ + public static boolean isUpgrade(ItemStack s) { return OrePrefixes.apiaryUpgrade.contains(s); } - public int applyMaxSpeedModifier(int maxspeed){ + public int applyMaxSpeedModifier(int maxspeed) { return Math.max(maxspeed, maxspeedmodifier); } private static final HashMap<Integer, GT_ApiaryUpgrade> quickLookup = new HashMap<>(); - static{ + static { EnumSet.allOf(GT_ApiaryUpgrade.class).forEach(GT_ApiaryUpgrade::setup_static_variables); - if(Loader.isModLoaded("gendustry")) { + if (Loader.isModLoaded("gendustry")) { ItemStack s = GT_ModHandler.getModItem("gendustry", "ApiaryUpgrade", 8L, 0); GT_Utility.ItemId a = GT_Utility.ItemId.createNoCopy(s); speed8upgraded.additionalGendustryUpgrades.put(a, s); diff --git a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java index 4f9036f2c7..f20a78d494 100644 --- a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java +++ b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java @@ -2,17 +2,17 @@ package gregtech.api.util; import static gregtech.GT_Mod.GT_FML_LOGGER; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; - import cpw.mods.fml.common.FMLCommonHandler; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; +import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -20,509 +20,514 @@ import net.minecraft.nbt.NBTTagString; import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.fluids.FluidStack; -import javax.annotation.Nonnull; - public class GT_AssemblyLineUtils { - /** - * A cache of Recipes using the Output as Key. - */ - private static HashMap<GT_ItemStack, GT_Recipe_AssemblyLine> sRecipeCacheByOutput = new HashMap<GT_ItemStack, GT_Recipe_AssemblyLine>(); - /** - * A cache of Recipes using the Recipe Hash String as Key. - */ - private static HashMap<String, GT_Recipe_AssemblyLine> sRecipeCacheByRecipeHash = new HashMap<String, GT_Recipe_AssemblyLine>(); - - - - /** - * Checks the DataStick for deprecated/invalid recipes, updating them as required. - * @param aDataStick - The DataStick to process - * @return Is this DataStick now valid with a current recipe? - */ - public static GT_Recipe_AssemblyLine processDataStick(ItemStack aDataStick) { - if (!isItemDataStick(aDataStick)) { - return null; - } - if (doesDataStickNeedUpdate(aDataStick)) { - ItemStack aStickOutput = getDataStickOutput(aDataStick); - if (aStickOutput != null) { - GT_Recipe_AssemblyLine aIntendedRecipe = findAssemblyLineRecipeByOutput(aStickOutput); - if (aIntendedRecipe != null && setAssemblyLineRecipeOnDataStick(aDataStick, aIntendedRecipe)) - return aIntendedRecipe; - } - } - return null; - } - - - /** - * Finds an Assembly Line recipe from a DataStick. - * @param aDataStick - The DataStick to check. - * @return The GT_Recipe_AssemblyLine recipe contained on the DataStick, if any. - */ - public static GT_Recipe_AssemblyLine findAssemblyLineRecipeFromDataStick(ItemStack aDataStick) { - return findAssemblyLineRecipeFromDataStick(aDataStick, false).getRecipe(); - } - - /** - * Finds an Assembly Line recipe from a DataStick. - * @param aDataStick - The DataStick to check. - * @param aReturnBuiltRecipe - Do we return a GT_Recipe_AssemblyLine built from the data on the Data Stick instead of searching the Recipe Map? - * @return The GT_Recipe_AssemblyLine recipe contained on the DataStick, if any. - */ - @Nonnull - public static LookupResult findAssemblyLineRecipeFromDataStick(ItemStack aDataStick, boolean aReturnBuiltRecipe) { - if (!isItemDataStick(aDataStick) || !doesDataStickHaveOutput(aDataStick)) { - return LookupResultType.INVALID_STICK.getResult(); - } - List<ItemStack> aInputs = new ArrayList<>(15); - ItemStack aOutput = getDataStickOutput(aDataStick); - List<List<ItemStack>> mOreDictAlt = new ArrayList<>(15); - List<FluidStack> aFluidInputs = new ArrayList<>(4); - - NBTTagCompound aTag = aDataStick.getTagCompound(); - if (aTag == null) { - return LookupResultType.INVALID_STICK.getResult(); - } - - //Get From Cache - if (doesDataStickHaveRecipeHash(aDataStick)) { - GT_Recipe_AssemblyLine aRecipeFromCache = sRecipeCacheByRecipeHash.get(getHashFromDataStack(aDataStick)); - if (aRecipeFromCache != null && GT_Utility.areStacksEqual(aOutput, aRecipeFromCache.mOutput)) { - return LookupResultType.VALID_STACK_AND_VALID_HASH.getResult(aRecipeFromCache); - } // else: no cache, or the old recipe run into a hash collision with a different new recipe - } - - for (int i = 0; i < 15; i++) { - int count = aTag.getInteger("a" + i); - if (!aTag.hasKey("" + i) && count <= 0) { - continue; - } - - List<ItemStack> tAltCurrent = new ArrayList<>(); - for (int j = 0; j < count; j++) { - ItemStack tLoaded = GT_Utility.loadItem(aTag, "a" + i + ":" + j); - if (tLoaded == null) { - continue; - } - tAltCurrent.add(tLoaded); - if (GT_Values.D1) { - GT_FML_LOGGER.info("Item Alt " + i + " : " + tLoaded.getUnlocalizedName()); - } - } - mOreDictAlt.add(tAltCurrent); - ItemStack tLoaded = GT_Utility.loadItem(aTag, "" + i); - if (tLoaded == null) { - continue; - } - aInputs.add(tLoaded); - if (GT_Values.D1) { - GT_FML_LOGGER.info("Item " + i + " : " + tLoaded.getUnlocalizedName()); - } - } - - if (GT_Values.D1) { - GT_FML_LOGGER.info("All Items done, start fluid check"); - } - for (int i = 0; i < 4; i++) { - if (!aTag.hasKey("f" + i)) continue; - FluidStack tLoaded = GT_Utility.loadFluid(aTag, "f" + i); - if (tLoaded == null) continue; - aFluidInputs.add(tLoaded); - if (GT_Values.D1) { - GT_FML_LOGGER.info("Fluid " + i + " " + tLoaded.getUnlocalizedName()); - } - } - if (!aTag.hasKey("output") || !aTag.hasKey("time") || aTag.getInteger("time") <= 0 || !aTag.hasKey("eu") || !GT_Utility.isStackValid(aOutput)) { - return LookupResultType.INVALID_STICK.getResult(); - } - if (GT_Values.D1) { - GT_FML_LOGGER.info("Found Data Stick recipe"); - } - - int aTime = aTag.getInteger("time"); - int aEU = aTag.getInteger("eu"); - - // Try build a recipe instance - if (aReturnBuiltRecipe) { - return LookupResultType.VALID_STACK_AND_VALID_HASH.getResult(new GT_Recipe_AssemblyLine(null, 0, aInputs.toArray(new ItemStack[0]), aFluidInputs.toArray(new FluidStack[0]), aOutput, aTime, aEU)); - } - - - for (GT_Recipe_AssemblyLine aRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { - if (aRecipe.mEUt != aEU || aRecipe.mDuration != aTime) continue; - if (!GT_Utility.areStacksEqual(aOutput, aRecipe.mOutput, true)) continue; - if (!GT_Utility.areStackListsEqual(Arrays.asList(aRecipe.mInputs), aInputs, false, true)) continue; - if (!Objects.equals(Arrays.asList(aRecipe.mFluidInputs), aFluidInputs)) continue; - if (!areStacksEqual(aRecipe.mOreDictAlt, mOreDictAlt)) continue; - - // Cache it - String aRecipeHash = generateRecipeHash(aRecipe); - sRecipeCacheByRecipeHash.put(aRecipeHash, aRecipe); - sRecipeCacheByOutput.put(new GT_ItemStack(aRecipe.mOutput), aRecipe); - if (doesDataStickHaveRecipeHash(aDataStick)) { - String aStickHash = getHashFromDataStack(aDataStick); - if (aRecipeHash.equals(aStickHash)) - return LookupResultType.VALID_STACK_AND_VALID_HASH.getResult(aRecipe); - } - return LookupResultType.VALID_STACK_AND_VALID_RECIPE.getResult(aRecipe); - } - return LookupResultType.VALID_STACK_BUT_INVALID_RECIPE.getResult(); - } - - private static boolean areStacksEqual(ItemStack[][] lhs, List<List<ItemStack>> rhs) { - for (int i = 0; i < lhs.length; i++) { - if (!areStacksEqual(lhs[i], rhs.get(i))) - return false; - } - return true; - } - - private static boolean areStacksEqual(ItemStack[] lhs, List<ItemStack> rhs) { - return lhs == null ? rhs.isEmpty() : !rhs.isEmpty() && GT_Utility.areStackListsEqual(Arrays.asList(lhs), rhs, false, true); - } - - - /** - * Finds a GT_Recipe_AssemblyLine based on the expected output ItemStack. - * @param aOutput - The Output of a GT_Recipe_AssemblyLine. - * @return First found GT_Recipe_AssemblyLine with matching output. - */ - public static GT_Recipe_AssemblyLine findAssemblyLineRecipeByOutput(ItemStack aOutput) { - if (aOutput == null) { - return null; - } - - // Check the cache - GT_ItemStack aCacheStack = new GT_ItemStack(aOutput); - GT_Recipe_AssemblyLine aRecipeFromCache = sRecipeCacheByOutput.get(aCacheStack); - if (aRecipeFromCache != null) { - return aRecipeFromCache; - } - - // Iterate all recipes and return the first matching based on Output. - for (GT_Recipe_AssemblyLine aRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { - ItemStack aRecipeOutput = aRecipe.mOutput; - if (GT_Utility.areStacksEqual(aRecipeOutput, aOutput)) { - // Cache it to prevent future iterations of all recipes - sRecipeCacheByOutput.put(aCacheStack, aRecipe); - sRecipeCacheByRecipeHash.put(generateRecipeHash(aRecipe), aRecipe); - return aRecipe; - } - } - return null; - } - - /** - * @param aRecipe - The recipe to generate a Recipe Hash String from. - * @return The Recipe Hash String. - */ - public static String generateRecipeHash(GT_Recipe_AssemblyLine aRecipe) { - String aHash = "Invalid.Recipe.Hash"; - if (aRecipe != null) { - aHash = "Hash."+aRecipe.getPersistentHash(); - } - return aHash; - } - - /** - * @param aRecipe - The recipe to add to internal caches - * @throws IllegalArgumentException if given recipe collide with any existing recipe in the cache - */ - public static void addRecipeToCache(GT_Recipe_AssemblyLine aRecipe) { - if (aRecipe != null) { - String aHash = "Hash." + aRecipe.getPersistentHash(); - GT_Recipe_AssemblyLine existing = sRecipeCacheByOutput.put(new GT_ItemStack(aRecipe.mOutput), aRecipe); - if (existing != null) - throw new IllegalArgumentException("Duplicate assline recipe for " + aRecipe.mOutput); - existing = sRecipeCacheByRecipeHash.put(aHash, aRecipe); - if (existing != null && !existing.equals(aRecipe)) - throw new IllegalArgumentException("Recipe hash collision for " + aRecipe + " and " + existing); - } - } - - /** - * @param aHash - Recipe hash String, may be null but will just be treated as invalid. - * @return Is this Recipe Hash String valid? - */ - public static boolean isValidHash(String aHash) { - if (aHash != null && aHash.length() > 0) { - // persistent hash can never be 0 - return !aHash.equals("Invalid.Recipe.Hash") && !aHash.equals("Hash.0"); - } - return false; - } - - /** - * @param aStack - The ItemStack to check. - * @return Is this ItemStack a Data Stick? - */ - public static boolean isItemDataStick(ItemStack aStack) { - return GT_Utility.isStackValid(aStack) && ItemList.Tool_DataStick.isStackEqual(aStack, false, true); - } - - /** - * @param aDataStick - The Data Stick to check. - * @return Does this Data Stick have a valid output ItemStack? - */ - public static boolean doesDataStickHaveOutput(ItemStack aDataStick) { - if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound() && aDataStick.getTagCompound().hasKey("output")) { - return true; - } - return false; - } - - /** - * @param aDataStick - The Data Stick to check. - * @return Does this Data Stick need recipe data updated. - */ - public static boolean doesDataStickNeedUpdate(ItemStack aDataStick) { - if (isItemDataStick(aDataStick) && doesDataStickHaveRecipeHash(aDataStick)) { - String aStickHash = getHashFromDataStack(aDataStick); - if (isValidHash(aStickHash) && doesDataStickHaveOutput(aDataStick)) { - ItemStack aStickOutput = getDataStickOutput(aDataStick); - GT_Recipe_AssemblyLine aIntendedRecipe = findAssemblyLineRecipeByOutput(aStickOutput); - if (aStickHash.equals(generateRecipeHash(aIntendedRecipe))) { - return false; - } - } - } - return true; - } - - /** - * @param aDataStick - The Data Stick to check. - * @return Does this have a Recipe Hash String at all? - */ - public static boolean doesDataStickHaveRecipeHash(ItemStack aDataStick) { - if (isItemDataStick(aDataStick) && aDataStick.hasTagCompound()) { - NBTTagCompound aNBT = aDataStick.getTagCompound(); - if (aNBT.hasKey("Data.Recipe.Hash") && !aNBT.getString("Data.Recipe.Hash").equals("Hash.0")) { |
