Anvils breaking colored name, is there a way to avoid this?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

skriptkitty

Member
Feb 19, 2020
2
0
0
23
on anvil rename:
name of player's tool contains "§"
cancel event


How do I make it combine but not rename?
 
I mean, you can check if the tool is a certain item (like a special item), and if it is then you can let it rename but change the name to the name of that special item if that makes sense
 
on anvil rename:
name of event-item contains "§"
set item-nbt of event-item-result to {Display: {Name: \'event-item\'}}


I tried this and it doesn't work

but I can't do that cus it'd be something I'd be doing for thousands of custom named items
 
Well first, Minecraft doesn't support the symbol "§" in it's font, so it uses a substitute, "&".

Second, the "on anvil rename" event triggers before the item is actually named, and when an item is colored it doesn't include that "&" or "§" symbol. [I don't think.]

Third, that last line "set item-nbt of event-item-result to {Display: {Name: \'event-item/'}}" is unnecessarily complicated. Just use the effect "set name of event-item to "Example Name""

EDIT:

You can bypass this whole situation by disabling anvil renaming as a whole.
Just use the following code if you wish to do so.
Code:
on anvil rename:
    cancel event
    send "&cYou cannot rename items!" # this part is optional
 
Status
Not open for further replies.