#How could I make the interface title of a chest change based on its color?
1 messages · Page 1 of 1 (latest)
Depends on how you're planning to store and set the value for the chest's color.
I believe everything is done in the registry. I am joining someone else who has been working on the code for a bit so I am trying to catch up in understanding
I would ask them but they are unsure as well
Which version of MC are you working on?
1.21.1
From looking through the code, I think what you want to look at is (using Mojang mappings here) the way the ChestBlock class creates a MenuProvider, which it then uses when it calls ServerPlayer#openMenu(MenuProvider menuProvider). That method sends a packet to the client with the relevant menu's characteristics.
The MenuProvider is what is used to get the display name in that server player method so if you can just make it so that when your colored chests are the ones involved when that server player method is called, the menu provider's getDisplayName() method call returns a name that is based on the chest's color, you'll have pretty much done it.
There's probably a handful of different ways you can go about making that happen, but I think it should be a good starting point for you to research how you want to do it as you flesh out your colored chests implementation.