* Fixes #3040: Cache recipe and revalidate it This caches the last used recipe instead of only the result. Which allows to revalidate the crafting grid against the recipe itself before hitting the CraftingManager again. Therefore avoiding a high performance hit for recipe lookups, just find the potential same recipe again. * Remove old recipe lookup as forge provides it now. * Further optimizations. These are a bit quick'n'dirty and need a better solution with a full container/gui refactoring. But for now they provide some great benefits in terms of performance.
This commit is contained in:
@@ -432,25 +432,6 @@ public class Platform
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The usual version of this returns an ItemStack, this version returns the recipe.
|
||||
*/
|
||||
public static IRecipe findMatchingRecipe( final InventoryCrafting inventoryCrafting, final World par2World )
|
||||
{
|
||||
IForgeRegistry<IRecipe> recipes = ForgeRegistries.RECIPES;
|
||||
final List<IRecipe> rl = recipes.getValues();
|
||||
|
||||
for( final IRecipe r : rl )
|
||||
{
|
||||
if( r.matches( inventoryCrafting, par2World ) )
|
||||
{
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack[] getBlockDrops( final World w, final BlockPos pos )
|
||||
{
|
||||
List<ItemStack> out = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user