mojira.dev
MC-298179

Resource packs containing Item Model Definitions with 1000 or more condition models cause StackOverflowErrors

Resource packs containing Item Model Definitions with 1000 or more condition models cause StackOverflowErrors, preventing players from adding more than 1000 component-based custom items without running into issues with the resource pack loading inconsistently.

In item model definitions the only way to read individual values inside the custom_data component is incredibly inefficient since you have to chain conditions which end up causing stack overflows when using over 1000 of them. Select properties can't work for this because they check the component strictly, checking all data inside of it and not individual values.

Steps to Reproduce

  1. Download the attached resource pack.

  2. Attempt to load the attached resource pack.

  3. Notice the resource reload fails, returning a StackOverflowError
    Successive attempts to load the resource pack will eventually cause it to load successfully, typically takes one or two attempts.

Making sure the resource pack is working

  • Once the attached resource pack loads, run the following command in a singleplayer world to verify the pack is working.
    (Replace “xyz” with any number between 1 and 999)

  • /give @s minecraft:player_head[custom_data={id:xyz}]
  • If the resource pack is working, this should give you a player head with an un-tinted Grass Block model.

  • Adding more data fields to the custom_data component will not change the outcome. Only the id field controls this.

Environment

MacOS Sequoia 15.5
2020 M1 MacBook Pro

Attachments

Comments 6

I think the correct way to do this is with select rather than nested conditions. But still, I can confirm the ticket as written.

@tryashtar

Select properties can't work for this because they check the component strictly, checking all data inside of it and not individual values.

Thank you for your report!
After consideration, the issue is being closed as Won't Fix.

Please note that this is not the same as Working as Intended, as this bug report correctly describes behavior in the game that might not be the intended or desirable behavior, but it will not be fixed right now. Sometimes, this is because the issue reported is minor and/or impossible to change without large architectural changes to the code base.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

While we are not looking to fix this, we think there is ways to work around this.

  • Use item_modelcomponent instead of custom data

  • Use custom_model_data and select instead

@Panda4994 These do not work around the problem this method solves.

  • Resource pack developers may not have the ability to change item data on a server if it is a fan-made pack, thus ruling out using custom_model_data and item_model.

  • As mentioned earlier, select only allows reading the entire component strictly, and cannot read individual values like condition can.

Currently making use of this in my Hypixel Plus resource pack (Link), since there are no other options available in vanilla that have this interaction.

ic22487

(Unassigned)

Confirmed

(Unassigned)

1.21.5, 25w21a

Retrieved