Skip to content

Commit

Permalink
try to decrease the likely of recipe key collision.
Browse files Browse the repository at this point in the history
  • Loading branch information
WanionCane committed Aug 21, 2016
1 parent 2247be0 commit 2cf9b78
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ public class ForgeRecipeResearcher implements IRecipeResearcher<ShapedOreRecipe,
@Override
public int getShapedRecipeKey(@Nonnull final IRecipe recipe, @Nonnull final ResourceHandler resourceHandler)
{
return MetaItem.getCumulative(((ShapedOreRecipe) recipe).getInput(), resourceHandler);
return MetaItem.getCumulative(((ShapedOreRecipe) recipe).getInput(), resourceHandler) + MetaItem.get(resourceHandler.getMainItemStack(recipe.getRecipeOutput()));
}

@Override
public int getShapelessRecipeKey(@Nonnull final IRecipe recipe, @Nonnull final ResourceHandler resourceHandler)
{
return MetaItem.getCumulative(((ShapelessOreRecipe) recipe).getInput().toArray(), resourceHandler);
return MetaItem.getCumulative(((ShapelessOreRecipe) recipe).getInput().toArray(), resourceHandler) + MetaItem.get(resourceHandler.getMainItemStack(recipe.getRecipeOutput()));
}

@SuppressWarnings("unchecked")
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/recipe/IC2RecipeResearcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ else if (input instanceof List) {
} else if (input instanceof IRecipeInput)
recipeId += MetaItem.get(((IRecipeInput) input).getInputs().get(0));
}
return recipeId;
return recipeId + MetaItem.get(resourceHandler.getMainItemStack(recipe.getRecipeOutput()));
}

@Override
Expand All @@ -63,7 +63,7 @@ else if (obj instanceof IRecipeInput)
recipeId += MetaItem.get(((IRecipeInput) obj).getInputs().get(0));
}
}
return recipeId;
return recipeId + MetaItem.get(resourceHandler.getMainItemStack(recipe.getRecipeOutput()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public class VanillaRecipeResearcher implements IRecipeResearcher<ShapedRecipes,
@Override
public int getShapedRecipeKey(@Nonnull final IRecipe recipe, @Nonnull final ResourceHandler resourceHandler)
{
return MetaItem.getCumulative(((ShapedRecipes) recipe).recipeItems, resourceHandler);
return MetaItem.getCumulative(((ShapedRecipes) recipe).recipeItems, resourceHandler) + MetaItem.get(resourceHandler.getMainItemStack(recipe.getRecipeOutput()));
}

@Override
public int getShapelessRecipeKey(@Nonnull final IRecipe recipe, @Nonnull final ResourceHandler resourceHandler)
{
return MetaItem.getCumulative(((ShapelessRecipes) recipe).recipeItems.toArray(), resourceHandler);
return MetaItem.getCumulative(((ShapelessRecipes) recipe).recipeItems.toArray(), resourceHandler) + MetaItem.get(resourceHandler.getMainItemStack(recipe.getRecipeOutput()));
}

@Override
Expand Down

0 comments on commit 2cf9b78

Please sign in to comment.