[SOLVED] Custom item name is always italic

Hey, thanks for taking your time and reading this.

Like the title suggests I am trying to do something simple, creating an itemstack with custom name. Sadly each time I do this, the custom item name is always italic. Even when I tried stuff such as but not limited to:

.add(Keys.DISPLAY_NAME, Text.builder().style(TextStyles.RESET).append(Text.of("DISPLAYNAME")))
.add(Keys.DISPLAY_NAME, Text.of(TextStyles.RESET, "DISPLAYNAME"))

both didn’t turn into a succes, but when I send the player a message using the exact same text builder it isn’t italic but like I wanted, normal.

Again, thanks for reading and possibly your suggestion!

I think that is vanilla game behavior - if you use an anvil to custom-name an itemstack, it also italicises

1 Like

No way to change that? I tried alot and I really do hope I can change it

Hopefully someone can weigh in with more encouraging info, but I know this has been looked at before, and brought up before.

I think that it is a client-side thing, that the client recognizes that the name is not default and renders as italics. Hopefully I am wrong, but, recall that being the explanation before. There are a few things that we would hope we had control over, but the client injects its own decisions about for who-knows-why reasons.

1 Like

Then I am curious how bukkit does this since bukkit for example is still a server thing and not a client-side thing. (Not trying to say sponge should be similair to bukkit in any way) So I don’t really think its a client-side thing

Default format for item names is white italic, and default format for item lore is purple italic. RESET just puts it back to that. Putting a color, however, clears formatting. So begin your text with TextColors.WHITE.

2 Likes

Thanks! This worked and thanks also for the explanation!

Excellent trick, thanks pie!