mojira.dev
MC-306074

Clicking on the map extending recipe result when the item is not filled_map will crash the game.

Detalied dscription

When attempting to retrieve the result of a recipe to expantendig or locking a map (by minecraft:crafting_special_mapextending or by using a cartography tablet), if the item is not minecraft:filled_map, the game fails to perform the post-process and crashes because the item continues to contain the minecraft:map_post_processing component. With the following error:

The game crashed: mousereleased event handler
Error: java.lang.IllegalArgumentException: Failed to hash minecraft:map_post_processing=>SCALE: Component of type minecraft:map_post_processing is not encodable
The game crashed: mousereleased event handler
Error: java.lang.IllegalArgumentException: Failed to hash minecraft:map_post_processing=>SCALE: Component of type minecraft:map_post_processing is not encodable

How to reproduce

In crafting table

  1. Create a data pack with a recipe of type minecraft:crafting_special_mapextending and a result other than minecraft:filled_map. For example, the recipe:

{
  "type": "minecraft:crafting_special_mapextending",
  "map": "minecraft:filled_map",
  "material": "minecraft:paper",
  "result": {
    "id": "minecraft:map"
  }
}
{
  "type": "minecraft:crafting_special_mapextending",
  "map": "minecraft:filled_map",
  "material": "minecraft:paper",
  "result": {
    "id": "minecraft:map"
  }
}
  1. Craft the recipe

    1. Be careful not to have a vanilla recipe or one from another datapack overlapping the recipe.

    2. For the craft to work, the map ingredient must have the minecraft:map_id component with an id that is already being used.

  2. Try to get the result of the recipe.

In cartography tablet

  1. Create an item with the minecraft:map_id component that is not the minecraft:filled_map.

    1. The map ID must already be in use for a valid map.

    2. For example, use the command /give @p map[minecraft:map_id=(n)], where (n) is the ID of a map that is already in use.

  2. With a paper or a glass pane, place this item on the cartographt tablet.

  3. Try to get the result of the recipe.

Code analysis

The method onCraftedPostProcess(ItemStack itemStack, Level level) is only non-empty for the minecraft:filled_map item; therefore, it does not process the component for all other items.

Move the method from the MapItem class to Item class would solve this bug. Although it would still leave the bug MC-303401

Notes

  • The bug in the craft table (now) only exists in version 26.1 Snapshot 5, as it wasn't possible to customize the recipe before then. However, the bug in the cartography table already existed before.

  • Important: The attached videos (by Aloi) shows some OBS Studio freezes that don't correspond to bugs in the game, and the cartography table video as well as a cut between the first crash and opening the world again. The game only freezes when click on the recipe result!

Attachments

Comments 1

Thank you for helping us improve Minecraft! We saved your files:

[media][media][media]

Aloi

(Unassigned)

Confirmed

(Unassigned)

26.1 Snapshot 5

Retrieved