mojira.dev
MC-305261

The enchant_with_levels and enchant_randomly functions can crash the game

This behavier has been reported in MC-305161, since I don’t know how result it will cause. But now I confirm it will crash the game.

How to Reproduce

  1. Held a Iron Sword.

  2. Run command to apply enchant_with_levels or enchant_randomly function, like this: /item modify entity @p weapon.mainhand {function:enchant_randomly, include_additional_cost_component :true}

  3. Open a chest.

  4. When you in chest inventory screen, attemp to move item.

Observed Result

The game crashed.

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

Expected Result

The game should not be crashed.

Linked issues

Attachments

Comments 1

Cannot reproduce this on 1.21.11

wplxfore

etanaratsastaja

Confirmed

Platform

Important

Commands, Crash

26.1 Snapshot 1

26.1 Snapshot 3

Retrieved