Fourmisain / KeepHeadNames

A Fabric/(Neo)Forge Minecraft mod that keeps player head names after placing them down
MIT License
3 stars 0 forks source link

Does this Mod/Datapack update existing heads upon updating to 1.20.5 from 1.20.4? #6

Open the-n1n opened 3 months ago

the-n1n commented 3 months ago

Existing heads had a pretty big problem with updating to 1.20.5 or higher from 1.20.4 or any other version being that they would break the names of the heads. This can be seen in MC-270625 which was marked as won't fix. The fix would be to auto update heads that are placed or in inventory to using the new format.

Fourmisain commented 3 months ago

Oh, I wasn't even aware of MC-270625!

The last version 1.6.0 of Keep Head Names was specifically made to allow upgrading heads placed with Keep Head Names to 1.20.5+. It'll keep the custom display names and lore tags, but it doesn't touch SkullOwner, so MC-270625 should still apply.

Though from the description of MC-270625, I think this is only about this specific format with spaces in the name, which is technically invalid, since SkullOwner is always supposed to be a player's profile name and profile names do not allow spaces.

So I'm pretty sure, regular SkullOwners will be correctly converted, but I haven't tested it.

Let me quickly do that. ... Yes, I can confirm that regular SkullOwners are correctly converted, so MC-270625 is only about this very specific misuse of the SkullOwner field, which shouldn't affect you unless you explicitly spawned in heads like with the commands they showed.

tl;dr: Yes.

the-n1n commented 3 months ago

Hmm okay, I am looking for something that will retroactively port things from the Skull Owner Name to the custom_name component as my server used the SkullOwner Name with spaces a lot in order to keep the names of the heads after being placed, even though it add's 's Head to the end. I doubt there is such a mod/datapack/plugin out there that will fix this so I will probably just have to live with the broken heads.

Fourmisain commented 3 months ago

I can try building a custom version to upgrade those names, if {SkullOwner:{Name:"Strong Bird"}} is the exact format, then that shouldn't be hard. So the idea is to get rid of the 's Head?

Fourmisain commented 3 months ago

may

Maybe that will work? I haven't tested it (currently have my hands full). If you wanna try it out, here's a release Obviously make backups first!

Fourmisain commented 3 months ago

Actually, I think the quotes around the names need to go. I think the double quotes used in commands (like player_head[item_name:'"Some Name"']) is just a syntax thing, but the string is actually just Some Name. Uploaded CUSTOM2, which should hopefully do the trick.

the-n1n commented 3 months ago

I tested it out and I don't think it worked but thank you for trying and making a mod version just to fix some random person's problem!

Fourmisain commented 3 months ago

thank you for trying and making a mod version just to fix some random person's problem!

Every problem is a random person's problem!

I see why it didn't work, the vanilla datafixer ran first, deleting SkullOwner in the process. The names also did have to be JSON encoded, so the first version was actually more correct.

Uploaded CUSTOM3, which does work! Note that it will only convert head that were placed down (so if you got any lying around in your chests, place them on the ground before updating), and it will replace any SkullOwner Name with item_name, even those without spaces (so the "'s Head" will disappear for all of them).

the-n1n commented 3 months ago

Wow! I will test this out tonight, Thanks you so much for the help!