Update MCP mappings to 20170617

This commit is contained in:
mezz committed 2017-06-17 18:06:04 -07:00
1 parent 3d322ef925
commit c2845967cc
27 files changed
+95 -88

No files matched your search

@@ -1,8 +1,10 @@
package net.minecraftforge.common.crafting;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.Lists;
@@ -28,29 +30,31 @@ public class CompoundIngredient extends Ingredient
}
@Override
public ItemStack[] func_193365_a()
@Nonnull
public ItemStack[] getMatchingStacks()
{
if (stacks == null)
{
List<ItemStack> tmp = Lists.newArrayList();
for (Ingredient child : children)
for (ItemStack stack : child.func_193365_a())
tmp.add(stack);
Collections.addAll(tmp, child.getMatchingStacks());
stacks = tmp.toArray(new ItemStack[tmp.size()]);
}
return stacks;
}
@Override
@Nonnull
@SideOnly(Side.CLIENT)
public IntList func_194139_b()
public IntList getValidItemStacksPacked()
{
//TODO: Add a child.isInvalid()?
if (this.itemIds == null)
{
this.itemIds = new IntArrayList();
for (Ingredient child : children)
this.itemIds.addAll(child.func_194139_b());
this.itemIds.addAll(child.getValidItemStacksPacked());
this.itemIds.sort(IntComparators.NATURAL_COMPARATOR);
}
@@ -114,11 +114,11 @@ public class CraftingHelper {
if (obj instanceof Ingredient)
return (Ingredient)obj;
else if (obj instanceof ItemStack)
return Ingredient.func_193369_a(((ItemStack)obj).copy());
return Ingredient.fromStacks(((ItemStack)obj).copy());
else if (obj instanceof Item)
return Ingredient.func_193367_a((Item)obj);
return Ingredient.fromItem((Item)obj);
else if (obj instanceof Block)
return Ingredient.func_193369_a(new ItemStack((Block)obj, 1, OreDictionary.WILDCARD_VALUE));
return Ingredient.fromStacks(new ItemStack((Block)obj, 1, OreDictionary.WILDCARD_VALUE));
else if (obj instanceof String)
return new OreIngredient((String)obj);
else if (obj instanceof JsonElement)
@@ -144,7 +144,7 @@ public class CraftingHelper {
if (ing.getClass() == Ingredient.class) {
//Vanilla, Due to how we read it splits each itemstack, so we pull out to re-merge later
for (ItemStack stack : ing.func_193365_a())
for (ItemStack stack : ing.getMatchingStacks())
vanilla.add(stack);
}
else
@@ -156,7 +156,7 @@ public class CraftingHelper {
if (!vanilla.isEmpty())
{
ItemStack[] items = vanilla.toArray(new ItemStack[vanilla.size()]);
ingredients.add(Ingredient.func_193369_a(items));
ingredients.add(Ingredient.fromStacks(items));
}
if (ingredients.size() == 0)
@@ -308,7 +308,7 @@ public class CraftingHelper {
}
HashMap<Character, Ingredient> itemMap = Maps.newHashMap();
itemMap.put(' ', Ingredient.field_193370_a);
itemMap.put(' ', Ingredient.EMPTY);
for (; idx < recipe.length; idx += 2)
{
@@ -334,7 +334,7 @@ public class CraftingHelper {
}
}
ret.input = NonNullList.withSize(ret.width * ret.height, Ingredient.field_193370_a);
ret.input = NonNullList.withSize(ret.width * ret.height, Ingredient.EMPTY);
Set<Character> keys = Sets.newHashSet(itemMap.keySet());
keys.remove(' ');
@@ -448,7 +448,7 @@ public class CraftingHelper {
ingMap.put(entry.getKey().toCharArray()[0], CraftingHelper.getIngredient(entry.getValue(), context));
}
ingMap.put(' ', Ingredient.field_193370_a);
ingMap.put(' ', Ingredient.EMPTY);
JsonArray patternJ = JsonUtils.getJsonArray(json, "pattern");
@@ -468,7 +468,7 @@ public class CraftingHelper {
pattern[x] = line;
}
NonNullList<Ingredient> input = NonNullList.withSize(pattern[0].length() * pattern.length, Ingredient.field_193370_a);
NonNullList<Ingredient> input = NonNullList.withSize(pattern[0].length() * pattern.length, Ingredient.EMPTY);
Set<Character> keys = Sets.newHashSet(ingMap.keySet());
keys.remove(' ');
@@ -503,15 +503,15 @@ public class CraftingHelper {
if (ings.size() > 9)
throw new JsonParseException("Too many ingredients for shapeless recipe");
ItemStack itemstack = ShapedRecipes.func_192405_a(JsonUtils.getJsonObject(json, "result"), true);
ItemStack itemstack = ShapedRecipes.deserializeItem(JsonUtils.getJsonObject(json, "result"), true);
return new ShapelessRecipes(group, itemstack, ings);
});
registerR("forge:ore_shaped", ShapedOreRecipe::factory);
registerR("forge:ore_shapeless", ShapelessOreRecipe::factory);
registerI("minecraft:item", (context, json) -> Ingredient.func_193369_a(CraftingHelper.getItemStackBasic(json, context)));
registerI("minecraft:empty", (context, json) -> Ingredient.field_193370_a);
registerI("minecraft:item_nbt", (context, json) -> Ingredient.func_193369_a(CraftingHelper.getItemStack(json, context)));
registerI("minecraft:item", (context, json) -> Ingredient.fromStacks(CraftingHelper.getItemStackBasic(json, context)));
registerI("minecraft:empty", (context, json) -> Ingredient.EMPTY);
registerI("minecraft:item_nbt", (context, json) -> Ingredient.fromStacks(CraftingHelper.getItemStack(json, context)));
registerI("forge:ore_dict", (context, json) -> new OreIngredient(JsonUtils.getString(json, "ore")));
}