Skip to content

Commit

Permalink
Do not copy upon getting the preference (reduce number of copies), it…
Browse files Browse the repository at this point in the history
… is on the modder to properly copy from our preference system
  • Loading branch information
KnightMiner committed Dec 8, 2017
1 parent a8598d3 commit ac29eb2
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ public static void setOrePreferences(String[] preferences) {
/**
* Gets the preferred ore for the given oredict name
* @param oreName Oredictionary key
* @return The preferred ItemStack, or ItemStack.EMPTY if the name is empty
* @return The preferred ItemStack, or ItemStack.EMPTY if the name is empty.
* This is the same ItemStack from the cache, so be sure to copy it if you plan to place it in an inventory or otherwise change it.
*/
public static ItemStack getPreference(String oreName) {
return preferenceCache.computeIfAbsent(oreName, RecipeUtil::cachePreference).copy();
return preferenceCache.computeIfAbsent(oreName, RecipeUtil::cachePreference);
}

/**
Expand Down

0 comments on commit ac29eb2

Please sign in to comment.