This a simple fix around registry execution for item tiers. Since an ItemTier would most likely be declared in a static final field, there needs to be extra care taken on the inputted ingredient parameters to make sure that they are not loaded until the registry has finished. To counteract this, static final initializer methods were used to add suppliers to all available constructors. The original constructors are deprecated as they should be removed during the next api break. All the fields are now properly deferred until first access.
There would be an issue of tags not being loaded yet. However, the only access provided to the ingredient is within RecipeContainer, so there should be no issue in basic implementation.
Also, to save on resources and not construct the supplier output over and over, a Lazy was used to make the supplier deterministic and save the first access.
This a simple fix around registry execution for item tiers. Since an
ItemTier
would most likely be declared in a static final field, there needs to be extra care taken on the inputted ingredient parameters to make sure that they are not loaded until the registry has finished. To counteract this, static final initializer methods were used to add suppliers to all available constructors. The original constructors are deprecated as they should be removed during the next api break. All the fields are now properly deferred until first access.There would be an issue of tags not being loaded yet. However, the only access provided to the ingredient is within
RecipeContainer
, so there should be no issue in basic implementation.Also, to save on resources and not construct the supplier output over and over, a Lazy was used to make the supplier deterministic and save the first access.