[1.12] Fix wood plank ore dictionary recipes (#4310)

This commit is contained in:
Nedelosk 2017-08-19 00:04:23 +02:00 committed by LexManos
parent 7273065132
commit a40df67004

View file

@ -60,6 +60,7 @@ import javax.annotation.Nonnull;
public class OreDictionary
{
private static final boolean DEBUG = false;
private static boolean hasInit = false;
private static List<String> idToName = new ArrayList<String>();
private static Map<String, Integer> nameToId = new HashMap<String, Integer>(128);
@ -222,7 +223,12 @@ public class OreDictionary
// wood-related things
replacements.put(new ItemStack(Items.STICK), "stickWood");
replacements.put(new ItemStack(Blocks.PLANKS), "plankWood");
replacements.put(new ItemStack(Blocks.PLANKS, 1, 0), "plankWood");
replacements.put(new ItemStack(Blocks.PLANKS, 1, 1), "plankWood");
replacements.put(new ItemStack(Blocks.PLANKS, 1, 2), "plankWood");
replacements.put(new ItemStack(Blocks.PLANKS, 1, 3), "plankWood");
replacements.put(new ItemStack(Blocks.PLANKS, 1, 4), "plankWood");
replacements.put(new ItemStack(Blocks.PLANKS, 1, 5), "plankWood");
replacements.put(new ItemStack(Blocks.PLANKS, 1, WILDCARD_VALUE), "plankWood");
replacements.put(new ItemStack(Blocks.WOODEN_SLAB, 1, WILDCARD_VALUE), "slabWood");
@ -330,8 +336,8 @@ public class OreDictionary
new ItemStack(Blocks.SPRUCE_FENCE),
new ItemStack(Blocks.SPRUCE_FENCE_GATE),
new ItemStack(Blocks.SPRUCE_STAIRS),
new ItemStack(Blocks.BIRCH_STAIRS),
new ItemStack(Blocks.BIRCH_FENCE_GATE),
new ItemStack(Blocks.BIRCH_FENCE),
new ItemStack(Blocks.BIRCH_STAIRS),
new ItemStack(Blocks.JUNGLE_FENCE),
new ItemStack(Blocks.JUNGLE_FENCE_GATE),
@ -342,14 +348,25 @@ public class OreDictionary
new ItemStack(Blocks.DARK_OAK_FENCE),
new ItemStack(Blocks.DARK_OAK_FENCE_GATE),
new ItemStack(Blocks.DARK_OAK_STAIRS),
new ItemStack(Blocks.WOODEN_SLAB),
new ItemStack(Blocks.WOODEN_SLAB, 1, WILDCARD_VALUE),
new ItemStack(Blocks.GLASS_PANE),
new ItemStack(Blocks.BONE_BLOCK), // Bone Block, to prevent conversion of dyes into bone meal.
new ItemStack(Items.BOAT),
new ItemStack(Items.SPRUCE_BOAT),
new ItemStack(Items.BIRCH_BOAT),
new ItemStack(Items.JUNGLE_BOAT),
new ItemStack(Items.ACACIA_BOAT),
new ItemStack(Items.DARK_OAK_BOAT),
new ItemStack(Items.OAK_DOOR),
new ItemStack(Items.SPRUCE_DOOR),
new ItemStack(Items.BIRCH_DOOR),
new ItemStack(Items.JUNGLE_DOOR),
new ItemStack(Items.ACACIA_DOOR),
new ItemStack(Items.DARK_OAK_DOOR),
ItemStack.EMPTY //So the above can have a comma and we don't have to keep editing extra lines.
};
FMLLog.log.info("Starts to replace vanilla recipe ingredients with ore ingredients.");
int replaced = 0;
// Search vanilla recipes for recipes to replace
for(IRecipe obj : CraftingManager.REGISTRY)
@ -357,11 +374,12 @@ public class OreDictionary
if(obj.getClass() == ShapedRecipes.class || obj.getClass() == ShapelessRecipes.class)
{
ItemStack output = obj.getRecipeOutput();
if (!output.isEmpty() && containsMatch(false, exclusions, output))
if (!output.isEmpty() && containsMatch(false, new ItemStack[]{ output }, exclusions))
{
continue;
}
Set<Ingredient> replacedIngs = new HashSet<>();
NonNullList<Ingredient> lst = obj.getIngredients();
for (int x = 0; x < lst.size(); x++)
{
@ -405,6 +423,11 @@ public class OreDictionary
//Replace!
lst.set(x, new OreIngredient(oreName));
replaced++;
if(DEBUG && replacedIngs.add(ing))
{
String recipeName = obj.getRegistryName().getResourcePath();
FMLLog.log.debug("Replaced {} of the recipe \'{}\' with \"{}\".", ing.getMatchingStacks(), recipeName, oreName);
}
}
}
}