2121import de .dafuqs .spectrum .registries .client .*;
2222import dev .emi .trinkets .api .*;
2323import net .fabricmc .fabric .api .entity .event .v1 .*;
24+ import net .fabricmc .fabric .api .event .*;
2425import net .fabricmc .fabric .api .event .lifecycle .v1 .*;
2526import net .fabricmc .fabric .api .event .player .*;
2627import net .fabricmc .fabric .api .item .v1 .*;
@@ -168,7 +169,6 @@ public static void register() {
168169
169170 SpectrumCommon .logInfo ("Injecting dynamic recipes into recipe manager..." );
170171 FirestarterIdolBlock .addBlockSmeltingRecipes (server );
171- injectEnchantmentUpgradeRecipes (server );
172172 });
173173
174174 EntitySleepEvents .STOP_SLEEPING .register ((entity , sleepingPos ) -> {
@@ -380,7 +380,6 @@ public void reload(ResourceManager manager) {
380380 SpectrumCommon .CACHED_ITEM_TAG_MAP .clear ();
381381
382382 if (SpectrumCommon .minecraftServer != null ) {
383- injectEnchantmentUpgradeRecipes (SpectrumCommon .minecraftServer );
384383 FirestarterIdolBlock .addBlockSmeltingRecipes (SpectrumCommon .minecraftServer );
385384 }
386385 }
@@ -392,27 +391,6 @@ public Identifier getFabricId() {
392391 });
393392 }
394393
395- // It could have been so much easier and performant, but KubeJS overrides the ENTIRE recipe manager
396- // and cancels all sorts of functions at HEAD unconditionally, so Spectrum cannot mixin into it
397- public static void injectEnchantmentUpgradeRecipes (MinecraftServer minecraftServer ) {
398- if (!EnchantmentUpgradeRecipeSerializer .enchantmentUpgradeRecipesToInject .isEmpty ()) {
399- ImmutableMap <Identifier , Recipe <?>> collectedRecipes = EnchantmentUpgradeRecipeSerializer .enchantmentUpgradeRecipesToInject .stream ().collect (ImmutableMap .toImmutableMap (EnchantmentUpgradeRecipe ::getId , enchantmentUpgradeRecipe -> enchantmentUpgradeRecipe ));
400- Map <RecipeType <?>, Map <Identifier , Recipe <?>>> recipes = ((RecipeManagerAccessor ) minecraftServer .getRecipeManager ()).getRecipes ();
401-
402- ArrayList <Recipe <?>> newList = new ArrayList <>();
403- for (Map <Identifier , Recipe <?>> r : recipes .values ()) {
404- newList .addAll (r .values ());
405- }
406- for (Recipe <?> recipe : collectedRecipes .values ()) {
407- if (!newList .contains (recipe )) {
408- newList .add (recipe );
409- }
410- }
411-
412- minecraftServer .getRecipeManager ().setRecipes (newList );
413- }
414- }
415-
416394 public static int getFluidLuminance (Fluid fluid ) {
417395 return fluidLuminance .getOrDefault (fluid , 0 );
418396 }
0 commit comments