Skip to content

Commit

Permalink
Fix UNDO message; fix recipe file growth
Browse files Browse the repository at this point in the history
- Fixed the minor debug message typo for "UNDO [BaseType] Removed x
Added y" having the Removed/Added counts backwards.
- Added code to reset the nbtList between each randomization to prevent
exponential recipe bloat in craycrafting.dat
  • Loading branch information
mellamokb committed Sep 11, 2015
1 parent b167e9d commit c3d66f8
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 c3d66f8

Please sign in to comment.