ochotonida / trofers

MIT License
3 stars 4 forks source link

Problems with color #19

Closed BazZziliuS closed 5 months ago

BazZziliuS commented 5 months ago

I made a custom trophy and gave it a color name, but it's not colored on the server, but it's colored in a single game

{
    "colors": {
      "accent": "#9f3a32",
      "base": "#606060"
    },
    "display": {
      "offset": {
        "y": 5.5
      },
      "scale": 2.0
    },
    "effects": {
      "sound": {
        "soundEvent": "minecraft:block.bell.use"
      }
    },
    "item": {
      "item": "gtceu:uhv_ultimate_battery",
      "count": 1
    },
    "animation": {
        "type": "tumbling",
        "speed": 0.50
      },
    "name": [
      { "text": "Тр", "color": "#FF01AFFD" },
      { "text": "оф", "color": "#FF37C1C8" },
      { "text": "ей", "color": "#FF78D585" },
      { "text": " Бе", "color": "#FFBBEB42", "bold": "true" },
      { "text": "ск", "color": "#FFFCF800", "bold": "true" },
      { "text": "он", "color": "#FFFDCB00", "bold": "true" },
      { "text": "еч", "color": "#FFFEA400", "bold": "true" },
      { "text": "но", "color": "#FFFE7D00", "bold": "true" },
      { "text": "сти", "color": "#FFFF6000", "bold": "true" }
    ]
  }

image

ochotonida commented 5 months ago

Which Minecraft version and mod loader are you using?

BazZziliuS commented 5 months ago

Which Minecraft version and mod loader are you using?

Client:

Minecraft 1.20.1 Forge 47.2.32

Server:

Mohist: 1.20.1-733 Forge: 47.2.32 NeoForge: 47.1.105 Bukkit: 997de31d CraftBukkit: ddc9a2dad Spigot: d2eba2c8

ochotonida commented 5 months ago

This seems to be an issue with how minecraft serializes and deserializes component colors that have an alpha channel. I'm not sure why this works in singleplayer but doesn't on servers, but you can fix it by removing the alpha value in your colors like this:

"name": [
    { "text": "Тр", "color": "#01AFFD" },
    { "text": "оф", "color": "#37C1C8" },
    { "text": "ей", "color": "#78D585" },
    { "text": " Бе", "color": "#BBEB42", "bold": "true" },
    { "text": "ск", "color": "#FCF800", "bold": "true" },
    { "text": "он", "color": "#FDCB00", "bold": "true" },
    { "text": "еч", "color": "#FEA400", "bold": "true" },
    { "text": "но", "color": "#FE7D00", "bold": "true" },
    { "text": "сти", "color": "#FF6000", "bold": "true" }
  ]
BazZziliuS commented 5 months ago

It's funny, but I added a tooltip with the colors that I threw above and they work fine.

Thanks