forked from EnigmaticaModpacks/Enigmatica2Expert
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: ⚡increase [Alloy Smelter] performance
Before this change, registering recipes required iterate over big amounts if registry to find what custom recipes could be x3, like when you can smelt 3 cobblestone at once. This takes 1-3 seconds on loading time for about ~16 custom recipes. I removed this x3 functionality for those 16 custom recipes (mostly compressed cobble => stone ones).
- Loading branch information
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+17.5 KB
...nderIO-1.12.2-5.3.72/crazypants/enderio/base/recipe/alloysmelter/AlloyRecipeManager.class
Binary file not shown.
91 changes: 91 additions & 0 deletions
91
...O-1.12.2-5.3.72/crazypants/enderio/base/recipe/alloysmelter/AlloyRecipeManager.class.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
@@ -92,18 +92,16 @@ extends AbstractMachineRecipe { | ||
Log.debug((Object[])new Object[]{"Recipe lookup table has been rebuilt with ", instance.rebuild(), " primary entries"}); | ||
} | ||
|
||
- public void addRecipe(boolean prohibitDupes, @Nonnull NNList<IRecipeInput> input, @Nonnull ItemStack output, int energyCost, float xpChance, @Nonnull RecipeLevel recipeLevel) { | ||
+ public void addRecipe(boolean prohibitDupes, NNList<IRecipeInput> input, ItemStack output, int energyCost, float xpChance, RecipeLevel recipeLevel) { | ||
Recipe recipe = new Recipe(new RecipeOutput(output, 1.0f, xpChance), energyCost, RecipeBonusType.NONE, recipeLevel, (IRecipeInput[])input.toArray((Object[])new IRecipeInput[0])); | ||
if (prohibitDupes && input.size() > 1) { | ||
this.addDedupedRecipe(recipe); | ||
- } else if (this.needsSynthetics(recipe)) { | ||
- this.addSyntheticRecipe(recipe); | ||
} else { | ||
this.addRecipe((IManyToOneRecipe)new BasicManyToOneRecipe(recipe)); | ||
} | ||
} | ||
|
||
- private void addDedupedRecipe(@Nonnull Recipe recipe) { | ||
+ private void addDedupedRecipe(Recipe recipe) { | ||
ItemStack output = recipe.getOutputs()[0].getOutput(); | ||
Log.debug((Object[])new Object[]{"Beginning de-duping loop for recipe that outputs ", output}); | ||
RecipeOutput recipeOutput = recipe.getOutputs()[0]; | ||
@@ -146,7 +144,7 @@ extends AbstractMachineRecipe { | ||
this.addRecipe(new BasicManyToOneRecipe(recipe).setDedupeInput()); | ||
} | ||
|
||
- private void addSyntheticRecipe(@Nonnull Recipe recipe) { | ||
+ private void addSyntheticRecipe(Recipe recipe) { | ||
int er = recipe.getEnergyRequired(); | ||
RecipeBonusType bns = recipe.getBonusType(); | ||
RecipeLevel lvl = recipe.getRecipeLevel(); | ||
@@ -176,13 +174,13 @@ extends AbstractMachineRecipe { | ||
return (Boolean)RecipeConfig.createSyntheticRecipes.get() != false && recipe.getInputs().length == 1 && recipe.getInputs()[0].getStackSize() <= recipe.getInputs()[0].getInput().func_77976_d() / 3 && recipe.getOutputs()[0].getOutput().func_190916_E() <= recipe.getOutputs()[0].getOutput().func_77976_d() / 3; | ||
} | ||
|
||
- private void addRecipe(@Nonnull IManyToOneRecipe recipe) { | ||
+ private void addRecipe(IManyToOneRecipe recipe) { | ||
this.dupeCheckRecipe((IRecipe)recipe); | ||
AlloyRecipeManager.addRecipeToLookup(this.lookup, recipe); | ||
this.addJEIIntegration(recipe); | ||
} | ||
|
||
- private static void addRecipeToLookup(@Nonnull TriItemLookup<IManyToOneRecipe> lookup, @Nonnull IManyToOneRecipe recipe) { | ||
+ private static void addRecipeToLookup(TriItemLookup<IManyToOneRecipe> lookup, IManyToOneRecipe recipe) { | ||
block7: { | ||
NNList list; | ||
block8: { | ||
@@ -219,7 +217,7 @@ extends AbstractMachineRecipe { | ||
} | ||
} | ||
|
||
- private void addJEIIntegration(@Nonnull IManyToOneRecipe recipe) { | ||
+ private void addJEIIntegration(IManyToOneRecipe recipe) { | ||
if (recipe.getInputs().length >= 2 && !recipe.isDedupeInput() && !recipe.isSynthetic()) { | ||
NNList inputs = new NNList(); | ||
for (int i = 0; i < recipe.getInputs().length; ++i) { | ||
@@ -252,7 +250,7 @@ extends AbstractMachineRecipe { | ||
} | ||
} | ||
|
||
- public IRecipe getRecipeForInputs(@Nonnull RecipeLevel machineLevel, @Nonnull NNList<MachineRecipeInput> inputs) { | ||
+ public IRecipe getRecipeForInputs(RecipeLevel machineLevel, NNList<MachineRecipeInput> inputs) { | ||
for (IManyToOneRecipe rec : this.lookup.getRecipesLMRI(inputs)) { | ||
if (!machineLevel.canMake(rec.getRecipeLevel()) || !rec.isInputForRecipe(inputs)) continue; | ||
return rec; | ||
@@ -260,7 +258,7 @@ extends AbstractMachineRecipe { | ||
return null; | ||
} | ||
|
||
- public boolean isValidInput(@Nonnull RecipeLevel machineLevel, @Nonnull MachineRecipeInput input) { | ||
+ public boolean isValidInput(RecipeLevel machineLevel, MachineRecipeInput input) { | ||
for (IManyToOneRecipe recipe : this.lookup.getRecipes(input.item.func_77973_b())) { | ||
if (!machineLevel.canMake(recipe.getRecipeLevel())) continue; | ||
for (IRecipeInput ri : recipe.getInputs()) { | ||
@@ -271,7 +269,7 @@ extends AbstractMachineRecipe { | ||
return false; | ||
} | ||
|
||
- public boolean isValidRecipeComponents(@Nonnull RecipeLevel machineLevel, @Nonnull NNList<ItemStack> input) { | ||
+ public boolean isValidRecipeComponents(RecipeLevel machineLevel, NNList<ItemStack> input) { | ||
for (IManyToOneRecipe recipe : this.lookup.getRecipesL(input)) { | ||
if (!machineLevel.canMake(recipe.getRecipeLevel()) || !recipe.isValidRecipeComponents(input)) continue; | ||
return true; | ||
@@ -279,7 +277,7 @@ extends AbstractMachineRecipe { | ||
return false; | ||
} | ||
|
||
- public float getExperienceForOutput(@Nonnull ItemStack output) { | ||
+ public float getExperienceForOutput(ItemStack output) { | ||
for (IManyToOneRecipe recipe : this.lookup) { | ||
if (recipe.getOutput().func_77973_b() != output.func_77973_b() || recipe.getOutput().func_77952_i() != output.func_77952_i()) continue; | ||
return recipe.getOutputs()[0].getExperiance(); |