Merge branch '1.9'

This commit is contained in:
cpw committed 2016-05-03 23:24:43 -04:00
commit f5781488d9
745 files changed
+18019 -14550

No files matched your search

@@ -52,7 +52,7 @@ public class OreDictionary
initVanillaEntries();
}
public static void initVanillaEntries()
private static void initVanillaEntries()
{
if (!hasInit)
{
@@ -351,7 +351,7 @@ public class OreDictionary
continue;
}
if(containsMatch(true, (ItemStack[])recipe.recipeItems.toArray(new ItemStack[recipe.recipeItems.size()]), replaceStacks))
if(containsMatch(true, recipe.recipeItems.toArray(new ItemStack[recipe.recipeItems.size()]), replaceStacks))
{
recipesToRemove.add((IRecipe)obj);
IRecipe newRecipe = new ShapelessOreRecipe(recipe, replacements);
@@ -364,7 +364,7 @@ public class OreDictionary
recipes.addAll(recipesToAdd);
if (recipesToRemove.size() > 0)
{
FMLLog.info("Replaced %d ore recipies", recipesToRemove.size());
FMLLog.info("Replaced %d ore recipes", recipesToRemove.size());
}
}
@@ -402,11 +402,11 @@ public class OreDictionary
}
/**
* Gets all the integer ID for the ores that the specified item stakc is registered to.
* Gets all the integer ID for the ores that the specified item stack is registered to.
* If the item stack is not linked to any ore, this will return an empty array and no new entry will be created.
*
* @param stack The item stack of the ore.
* @return An array of ids that this ore is registerd as.
* @return An array of ids that this ore is registered as.
*/
public static int[] getOreIDs(ItemStack stack)
{
@@ -417,7 +417,7 @@ public class OreDictionary
// 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.
// APPARENTLY it's quite common to do this. OreDictionary should be considered alongside Recipes - you can't make them properly until you've registered with the game.
ResourceLocation registryName = stack.getItem().delegate.getResourceName();
ResourceLocation registryName = stack.getItem().delegate.name();
int id;
if (registryName == null)
{
@@ -579,7 +579,7 @@ public class OreDictionary
// 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.
// APPARENTLY it's quite common to do this. OreDictionary should be considered alongside Recipes - you can't make them properly until you've registered with the game.
ResourceLocation registryName = ore.getItem().delegate.getResourceName();
ResourceLocation registryName = ore.getItem().delegate.name();
int hash;
if (registryName == null)
{
@@ -615,14 +615,24 @@ public class OreDictionary
public static class OreRegisterEvent extends Event
{
public final String Name;
public final ItemStack Ore;
private final String Name;
private final ItemStack Ore;
public OreRegisterEvent(String name, ItemStack ore)
{
this.Name = name;
this.Ore = ore;
}
public String getName()
{
return Name;
}
public ItemStack getOre()
{
return Ore;
}
}
public static void rebakeMap()
@@ -636,7 +646,7 @@ public class OreDictionary
for (ItemStack ore : ores)
{
// HACK: use the registry name's ID. It is unique and it knows about substitutions
ResourceLocation name = ore.getItem().delegate.getResourceName();
ResourceLocation name = ore.getItem().delegate.name();
int hash;
if (name == null)
{
@@ -19,16 +19,17 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.RecipeBookCloning;
import net.minecraft.item.crafting.RecipeFireworks;
import net.minecraft.item.crafting.RecipeRepairItem;
import net.minecraft.item.crafting.RecipeTippedArrow;
import net.minecraft.item.crafting.RecipesArmorDyes;
import net.minecraft.item.crafting.RecipesMapCloning;
import net.minecraft.item.crafting.RecipesMapExtending;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.item.crafting.ShieldRecipes;
import net.minecraft.item.crafting.RecipesBanners.RecipeAddPattern;
import net.minecraft.item.crafting.RecipesBanners.RecipeDuplicatePattern;
import static net.minecraftforge.oredict.RecipeSorter.Category.*;
@SuppressWarnings("rawtypes")
public class RecipeSorter implements Comparator<IRecipe>
{
public enum Category
@@ -69,7 +70,7 @@ public class RecipeSorter implements Comparator<IRecipe>
}
else
{
throw new IllegalArgumentException("Invalid dependancy: " + dep);
throw new IllegalArgumentException("Invalid dependency: " + dep);
}
}
}
@@ -102,12 +103,12 @@ public class RecipeSorter implements Comparator<IRecipe>
}
};
private static Map<Class, Category> categories = Maps.newHashMap();
//private static Map<String, Class> types = Maps.newHashMap();
private static Map<Class<?>, Category> categories = Maps.newHashMap();
//private static Map<String, Class<?>> types = Maps.newHashMap();
private static Map<String, SortEntry> entries = Maps.newHashMap();
private static Map<Class, Integer> priorities = Maps.newHashMap();
private static Map<Class<?>, Integer> priorities = Maps.newHashMap();
public static RecipeSorter INSTANCE = new RecipeSorter();
public static final RecipeSorter INSTANCE = new RecipeSorter();
private static boolean isDirty = true;
private static SortEntry before = new SortEntry("Before", null, UNKNOWN, "");
@@ -118,8 +119,10 @@ public class RecipeSorter implements Comparator<IRecipe>
register("minecraft:shaped", ShapedRecipes.class, SHAPED, "before:minecraft:shapeless");
register("minecraft:mapextending", RecipesMapExtending.class, SHAPED, "after:minecraft:shaped before:minecraft:shapeless");
register("minecraft:shapeless", ShapelessRecipes.class, SHAPELESS, "after:minecraft:shaped");
register("minecraft:shield_deco", ShieldRecipes.Decoration.class, SHAPELESS, "after:minecraft:shapeless"); //Size 2
register("minecraft:repair", RecipeRepairItem.class, SHAPELESS, "after:minecraft:shapeless"); //Size 4
register("minecraft:bookcloning", RecipeBookCloning.class, SHAPELESS, "after:minecraft:shapeless"); //Size 9
register("minecraft:tippedarrow", RecipeTippedArrow.class, SHAPELESS, "after:minecraft:shapeless"); //Size 9
register("minecraft:fireworks", RecipeFireworks.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10
register("minecraft:armordyes", RecipesArmorDyes.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10
register("minecraft:mapcloning", RecipesMapCloning.class, SHAPELESS, "after:minecraft:shapeless"); //Size 10
@@ -142,21 +145,21 @@ public class RecipeSorter implements Comparator<IRecipe>
return getPriority(r2) - getPriority(r1); // high priority value first!
}
private static Set<Class> warned = Sets.newHashSet();
private static Set<Class<?>> warned = Sets.newHashSet();
public static void sortCraftManager()
{
bake();
FMLLog.fine("Sorting recipies");
FMLLog.fine("Sorting recipes");
warned.clear();
Collections.sort(CraftingManager.getInstance().getRecipeList(), INSTANCE);
}
public static void register(String name, Class<?> recipe, Category category, String dependancies)
public static void register(String name, Class<?> recipe, Category category, String dependencies)
{
assert(category != UNKNOWN) : "Category must not be unknown!";
isDirty = true;
SortEntry entry = new SortEntry(name, recipe, category, dependancies);
SortEntry entry = new SortEntry(name, recipe, category, dependencies);
entries.put(name, entry);
setCategory(recipe, category);
}
@@ -213,13 +216,13 @@ public class RecipeSorter implements Comparator<IRecipe>
if (ret != null)
{
priorities.put(recipe.getClass(), ret);
FMLLog.fine(" Parent Found: %d - %s", ret.intValue(), cls.getName());
return ret.intValue();
FMLLog.fine(" Parent Found: %d - %s", ret, cls.getName());
return ret;
}
}
}
return ret == null ? 0 : ret.intValue();
return ret == null ? 0 : ret;
}
private static void bake()
@@ -135,15 +135,15 @@ public class ShapedOreRecipe implements IRecipe
for(int i = 0; i < input.length; i++)
{
ItemStack ingred = recipe.recipeItems[i];
ItemStack ingredient = recipe.recipeItems[i];
if(ingred == null) continue;
if(ingredient == null) continue;
input[i] = recipe.recipeItems[i];
for(Entry<ItemStack, String> replace : replacements.entrySet())
{
if(OreDictionary.itemMatches(replace.getKey(), ingred, true))
if(OreDictionary.itemMatches(replace.getKey(), ingredient, true))
{
input[i] = OreDictionary.getOres(replace.getValue());
break;
@@ -60,12 +60,12 @@ public class ShapelessOreRecipe implements IRecipe
{
output = recipe.getRecipeOutput();
for(ItemStack ingred : ((List<ItemStack>)recipe.recipeItems))
for(ItemStack ingredient : recipe.recipeItems)
{
Object finalObj = ingred;
Object finalObj = ingredient;
for(Entry<ItemStack, String> replace : replacements.entrySet())
{
if(OreDictionary.itemMatches(replace.getKey(), ingred, false))
if(OreDictionary.itemMatches(replace.getKey(), ingredient, false))
{
finalObj = OreDictionary.getOres(replace.getValue());
break;