Skip to content

Instantly share code, notes, and snippets.

@apple502j
Created September 1, 2023 16:13
Show Gist options
  • Save apple502j/a3ffb06042bee572049498f9c26665ca to your computer and use it in GitHub Desktop.
Save apple502j/a3ffb06042bee572049498f9c26665ca to your computer and use it in GitHub Desktop.

23w35a: Recipes Update

Weekly Update Stuff is back! I do skip an update or two, if the changes are not noteworthy. This week, Mojang had a small changelog - but the code changes are big. So here they are.

Fabric updates

Fabric API 0.87.2 for 23w35a was released, with several breaking changes.

  • Data Generation API v13 and Recipe API v2 received significant changes to reflect vanilla code changes.
  • Message API was bumped to v6. Vanilla MessageDecorator is now, once again, synchronous. Yes, I introduced a change that broke data packs. Sorry.
  • Object Builder API v12 just removes the deprecated CriterionRegistry.

Minecraft update

Recipes and advancements

Recipe and advancement code was refactored to use records. In addition, RecipeEntry or AdvancementEntry is used in many places where a raw recipe or advancement is used previously. As the name suggests, this is a pair of the ID and the value. If you want to get the recipe/advancement itself, call .value(). In RecipeProvider, exporter is now of type RecipeExporter, not Consumer<RecipeJsonProvider>. The usage remains the same; to output a recipe, call accept.

Recipes and ingredients are serialized to and from the disk using Codecs. Fabric API's CustomIngredientSerializer now has codec method that returns codec, instead of read/write taking JsonObject. (read/write taking PacketByteBuf still exists.) To make the migration easier, you can use Codecs#fromJsonSerializer - though this is deprecated. Hey, learn codecs, it's fun once you get used to it!

Yarn mapping received a couple of renames. Most significantly, "input" and "output" are now called "ingredient" and "result".

Misc

  • In EntryListWidget#mouseClicked, the mouse button is now automatically checked. Override isSelectButton to allow right-clicking entries to select one. The checks in individual entries are now redundant.
  • AbstractRedstoneGateBlock#canPlaceAbove was added. As the name indicates, this checks if a gate can be placed above a certain block.
  • MeleeAttackGoal#canAttack was added. This is checked inside attack method.
  • Several new codecs were added to Codecs: object2BooleanMap, alternatively (like either, except they are of the same type), and createRecursive, which is useful when a serialized field needs to reference the codec itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment