PGM
PGM copied to clipboard
Custom head as armor can't be locked
If you put a custom head on your helmet armor slot you can't lock it so the player will always be able to take it off which made me cry yesterday make it so i can put locked="true" within
mame can vouch
It would be helpful if you provide a MRE for whoever wants to test and fix the issue, otherwise you're making whoever wants to debug the issue have to create or search for a map to test this on
I made a map "Badlands Champions" it should be loaded on mapdev. It utilizes classes and i put a custom head on each of them. I tried putting locked="true" into
it did nothing and mame also tried some other ways how to fix it but didnt succeed ( i think he tried putting inside of
this is an example of usage of <head/>
with which locking is not possible
<class name="Ranger" description="Shoot Arrows" icon="bow">
<kit parents="spawn-protection">
<item slot="0" unbreakable="true">stone sword</item>
<item slot="1" unbreakable="true">bow</item>
<item slot="3" amount="1">golden apple</item>
<item slot="8" amount="28">arrow</item>
<head slot="slot.armor.head" locked="true" name="Ranger" uuid="4d80305f-70c7-403a-9e31-f55179acdbbf">
<skin>ewogICJ0aW1lc3RhbXAiIDogMTY0NzU1MDAxNDM0NSwKICAicHJvZmlsZUlkIiA6ICI0ZDgwMzA1ZjcwYzc0MDNhOWUzMWY1NTE3OWFjZGJiZiIsCiAgInByb2ZpbGVOYW1lIiA6ICJDb2R5NTc5IiwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2NlOWM1YjIyZDI5OWNhYjhlNTAyODM0MzRiZTYxOTBiN2MzZGI3MDc1Yzk0ZTk4NWU2MDQzNzNjODBlNjZiNzMiLAogICAgICAibWV0YWRhdGEiIDogewogICAgICAgICJtb2RlbCIgOiAic2xpbSIKICAgICAgfQogICAgfQogIH0KfQ==</skin>
</head>
<chestplate unbreakable="true">iron chestplate</chestplate>
<leggings unbreakable="true" material="iron leggings">
<enchantment level="3">projectile_protection</enchantment>
</leggings>
<boots unbreakable="true">iron boots</boots>
</kit>
</class>
I tested to see if this was somehow related to defining a class within a kit and it doesn't seem to be. ~~Interestingly, the head item seems as though it's locked but can be removed if you click a couple more times.~~ Edit: given #977 I think this was a fluke
Here's a download of an OCC community map submission which I've edited the XML to try to lock head items added to a kit as armour.
Resolved in https://github.com/PGMDev/PGM/pull/1146?
Even if it's a bit of a weird fix, it is a fix. The issue resides in armor being handled differently to items in pgm, and when you need head (or book etc) metadata you can't really put it as part of the ArmorKit (one of helmet, chestplate, etc) and instead have to use them as item, but with slot being head. Since locked is now supported for those items too, the difference i believe is purely technical and can likely be ignored.