Skip to content

Commit

Permalink
Merge pull request #5 from mellamokb/master
Browse files Browse the repository at this point in the history
Fix UNDO message; fix recipe file growth
  • Loading branch information
dries007 committed Sep 11, 2015
2 parents b167e9d + c3d66f8 commit 0526d2b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Expand Up @@ -159,7 +159,7 @@ public void undo()
{
if (applied)
{
CrayCrafting.instance.logger.info("UNDO " + getTypeName() + "\t Removed " + removedList.size() + "\t & added " + addedList.size() + "\t recipes from " + FMLCommonHandler.instance().getEffectiveSide());
CrayCrafting.instance.logger.info("UNDO " + getTypeName() + "\t Removed " + addedList.size() + "\t & added " + removedList.size() + "\t recipes from " + FMLCommonHandler.instance().getEffectiveSide());
applied = false;
CraftingManager.getInstance().getRecipeList().removeAll(addedList);
CraftingManager.getInstance().getRecipeList().addAll(removedList);
Expand All @@ -176,6 +176,16 @@ public NBTTagList getNBTList()
{
return nbtList;
}

/**
* Used to clear existing randomized recipes in nbt file data, before adding the new ones.
* <p/>
* Used on server only.
*/
public void resetNBTList()
{
nbtList = new NBTTagList();
}

/**
* Used on server only.
Expand Down
Expand Up @@ -147,6 +147,11 @@ public static void randomizeRecipes(File recipeFile)
ArrayList<ItemStack> outputs = new ArrayList<ItemStack>(CraftingManager.getInstance().getRecipeList().size());
ArrayList<IRecipe> acceptedRecipes = new ArrayList<IRecipe>();

for (BaseType<IRecipe> baseType : typeList)
{
baseType.resetNBTList();
}

for (IRecipe recipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList())
{
for (BaseType<IRecipe> baseType : typeList)
Expand Down

0 comments on commit 0526d2b

Please sign in to comment.