mirror of
https://github.com/barkeser2002/Tenet.git
synced 2026-09-25 09:26:00 +03:00
61 lines
2.7 KiB
Diff
61 lines
2.7 KiB
Diff
--- ../src-base/minecraft/net/minecraftforge/oredict/OreDictionary.java
|
|
+++ ../src-work/minecraft/net/minecraftforge/oredict/OreDictionary.java
|
|
@@ -221,7 +221,7 @@
|
|
{
|
|
ShapedRecipes recipe = (ShapedRecipes)obj;
|
|
ItemStack output = recipe.getRecipeOutput();
|
|
- if (output != null && containsMatch(false, exclusions, output))
|
|
+ if ((output != null && containsMatch(false, exclusions, output)) || output == null) // Cauldron - fixes NPE's with null recipes being added to forge
|
|
{
|
|
continue;
|
|
}
|
|
@@ -236,7 +236,7 @@
|
|
{
|
|
ShapelessRecipes recipe = (ShapelessRecipes)obj;
|
|
ItemStack output = recipe.getRecipeOutput();
|
|
- if (output != null && containsMatch(false, exclusions, output))
|
|
+ if ((output != null && containsMatch(false, exclusions, output)) || output == null) // Cauldron - fixes NPE's with null recipes being added to forge
|
|
{
|
|
continue;
|
|
}
|
|
@@ -335,7 +335,6 @@
|
|
{
|
|
if (stack == null || stack.getItem() == null) return new int[0];
|
|
|
|
- Set<Integer> set = new HashSet<Integer>();
|
|
|
|
// HACK: use the registry name's ID. It is unique and it knows about substitutions. Fallback to a -1 value (what Item.getIDForItem would have returned) in the case where the registry is not aware of the item yet
|
|
// IT should be noted that -1 will fail the gate further down, if an entry already exists with value -1 for this name. This is what is broken and being warned about.
|
|
@@ -351,15 +350,24 @@
|
|
{
|
|
id = GameData.getItemRegistry().getId(registryName);
|
|
}
|
|
+
|
|
+ Set<Integer> set;
|
|
+ int count = 0;
|
|
List<Integer> ids = stackToId.get(id);
|
|
- if (ids != null) set.addAll(ids);
|
|
- ids = stackToId.get(id | ((stack.getItemDamage() + 1) << 16));
|
|
- if (ids != null) set.addAll(ids);
|
|
+ if (ids != null) count += ids.size();
|
|
+ List<Integer> ids2 = stackToId.get(id | ((stack.getItemDamage() + 1) << 16));
|
|
+ if (ids2 != null) count += ids2.size();
|
|
+ set = new HashSet<Integer>(count);
|
|
|
|
- Integer[] tmp = set.toArray(new Integer[set.size()]);
|
|
- int[] ret = new int[tmp.length];
|
|
- for (int x = 0; x < tmp.length; x++)
|
|
- ret[x] = tmp[x];
|
|
+ boolean fal = ids != null ? set.addAll(ids): false;
|
|
+ fal = ids2 != null ? set.addAll(ids2) : false;
|
|
+
|
|
+ int[] ret = new int[count];
|
|
+ count = 0;
|
|
+ for(Iterator<Integer> it = set.iterator(); it.hasNext();)
|
|
+ {
|
|
+ ret[count++] = it.next();
|
|
+ }
|
|
return ret;
|
|
}
|
|
|