Enchancement

Enchancement

596k Downloads

Game crash upon swapping items in Enchantment table

pomy97 opened this issue ยท 1 comments

commented

Confirmations

  • I can verify that I am running the mod on the latest possible Minecraft version.
  • I can verify that the issue I am reporting exists on the latest possible Mod version.

Mod version (NOT Minecraft version)

1.21.4-r2

A description of the issue

Mods installed

Fabric API
Enchancement

Bug description

When swapping items certain items out in the enchantment table (specifically ones that can be enchanted with multiple types of materials), the game can have a rendering error and crash. I suspect this is because the lists the code uses to determine what item previews in that slot are different lengths. For example, the preview is displaying item number 2 on a 3 item long list. You swap the items so that the preview list changes from 3 items long to 1 item long. It tries to find item number 2, fails to render it (because it doesn't exist) and then crashes.

Steps to reproduce

  1. Get the following items
    • An enchantable wooden or stone item. In the video I used a stone item, but it is easier to reproduce with a wooden one.
    • Another enchantable item that isn't one of the types listed above. I used a diamond item.
  2. Place the wooden/stone item in the enchantment table. Take note of the slot that shows what materials can be but into it.
  3. Wait for the material preview to change items, then swap the two items in the enchantment slot by clicking. (See video, 0:21)
  4. Crash

Video demonstration

2025-01-30.17-36-26.mp4

Log or crash report

https://gist.github.com/pomy97/d10c1f0652e2f761aeb6dfab5c925e6b

commented

Highly specific but good catch, thanks!