Skip to content

Conversation

@Patbox
Copy link
Contributor

@Patbox Patbox commented Nov 2, 2025

With FabricMC/fabric-api#4926 being merged and released as Fabric API 0.137.0+1.21.10, JEI can now release updated version on Fabric.

Naturally the mod is needed on server to works (same as neoforge) to enable required recipes.

Changes are pretty simple, since fabric also just syncs Recipe objects.

Solves Fabric side of #4040

@CLAassistant
Copy link

CLAassistant commented Nov 2, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Owner

@mezz mezz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing!

var recipeSerializer = new JeiShapedRecipe.Serializer();
var registered = Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, resourceLocation, recipeSerializer);
RecipeSerializers.register(() -> registered);
RecipeSynchronization.synchronizeRecipeSerializer(recipeSerializer);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JeiShapedRecipe do not exist on the server, so I think we can remove this

Comment on lines 33 to 35
for (var serializer : BuiltInRegistries.RECIPE_SERIALIZER.keySet()) {
if (serializer.getNamespace().equals(ResourceLocation.DEFAULT_NAMESPACE)) {
RecipeSynchronization.synchronizeRecipeSerializer(Objects.requireNonNull(BuiltInRegistries.RECIPE_SERIALIZER.getValue(serializer)));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to iterate over entries instead of the keySet, so that you don't need Objects.requireNonNull

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally did that, but this ended it slightly cleaner (andwith few less lookups I guess). Technically it can't be null anyway, just added that so intelij doesn't warn

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay checked and doing it the other way around still wants Objects#equireNonNull, as Registry#getKey can technically return null.

ClientLifecycleHandler clientLifecycleHandler = new ClientLifecycleHandler();

ClientRecipeSynchronizedEvent.EVENT.register((minecraft, synchronizedRecipes) -> {
Internal.setClientSyncedRecipes(RecipeMap.create(synchronizedRecipes.recipes()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the future, it may be nice if the event provided a shared RecipeMap, to avoid having multiple mods create it

@mezz mezz merged commit 597a0f6 into mezz:1.21.10 Nov 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants