SammySemicolon / Malum-Mod

A minecraft mod about dark magic.
GNU Lesser General Public License v3.0
90 stars 36 forks source link

Fix vanilla recipe replacements #286

Closed cph101 closed 2 months ago

cph101 commented 2 months ago

This PR changes certain methods and fields within MalumVanillaRecipeReplacements to be static. It also adds a nested mixin, to handle the changes in vanilla recipe generation.

The mixin uses a static field injected into VanillaRecipeProvider to store the class of the most recently used instance. A check is injected into RecipeBuilder.save to pass the RecipeBuilder through MalumVanillaRecipeReplacements.enhance if the field matches said class. This will always work, since VanillaRecipeProvider.buildRecipes calls RecipeBuilder.save , which, according to the mixin, happens after storing the class.

TLDR; It's hacky, so please review carefully

SammySemicolon commented 2 months ago

crazy