[SPIGOT-7731] Damageable#setMaxDamage (or setDamage) does not work on spawn eggs Created: 06/Jun/24  Updated: 25/Dec/24  Resolved: 10/Jun/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Steven van der Werf Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: Durability, damage, spawnegg
Environment:

Doesn't matter I think


Attachments: File spawneggdamage-1.0-SNAPSHOT.jar    
Version: 4184-Spigot-fcd94e2-16c9767 (MC: 1.20.6) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
Plugin: developing my own plugin
Guidelines Read: Yes

 Description   

When max damage or damage is set, instead of getting durability, the spawn egg either turns into a different type, disapears completely, or remains the same but no durability is actually present (when viewed with F3 + H, and no bar appears).

 

The time such an item is created the message "Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!" appears.

 

to recreate, create a new ItemStack, set the material to a Creeper spawn egg for example, and then set the max durability on the item meta. Then when changing the damage on the item the bug is visible.

 

Using minimal plugin attached, I added a command with syntax /egg item_name max_dmg dmg.

for example /egg bat_spawn_egg 600 3 gives me nothing and /egg bat_spawn_egg 600 4 gives me elder guardian spawn egg.



 Comments   
Comment by Doc [ 08/Jun/24 ]

Created a "hotfix" PR for this issue https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1415/overview 

Currently this only fix the create of the item with damage component

 

In teory can be tested with 

java -jar BuildTools.jar --compile spigot --pr craftbukkit:1415
Comment by Doc [ 07/Jun/24 ]

The issue is for the CraftBukkit side mostly the updateMaterial called in the setItemMeta where the damage is being reset and the item change to a legacy version of this.

Generated at Thu Apr 03 16:58:09 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.