fix: preserve CustomModelData when dropping MythicMobs items#60
Open
JrouleEnGolf5 wants to merge 2 commits intoWertik:masterfrom
Open
fix: preserve CustomModelData when dropping MythicMobs items#60JrouleEnGolf5 wants to merge 2 commits intoWertik:masterfrom
JrouleEnGolf5 wants to merge 2 commits intoWertik:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes MythicMobs item drops losing generated metadata (e.g., CustomModelData) by avoiding MythicMobs wrapper setters that reconstruct/wipe ItemMeta and instead mutating the generated Bukkit ItemStack’s existing ItemMeta.
Changes:
- Retrieve the generated Bukkit
ItemStackfrom MythicMobs and return it directly. - Apply the BlockRegen
parserto the already-rendered display name/lore via BukkitItemMeta(preserving existing metadata).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Author
|
After a short beta test of the plugin, it turns out the issue still persists. I think I’ve found the cause, and I’ll update the pull request tonight. |
Author
|
I tested with this version and it seems to have fixed the issue. Over to you ;) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a block drops an item configured with
item: mythic:<id>, theresulting ItemStack sometimes had no CustomModelData.
After generating the item via
mythicItem.generateItemStack(amount),the code was calling
BukkitItemStack.setName()andBukkitItemStack.setLore()on the MythicMobs wrapper. These calls reconstruct the ItemMeta internally,
wiping metadata set by MythicMobs during generation — including CustomModelData,
attribute modifiers, and other NBT data.
Additionally, the lore/name passed came from
mythicItem.getLore()/mythicItem.getDisplayName()— the raw config strings, before MythicMobs'own rendering pipeline (color codes, MM placeholders, etc.).
Fix
Retrieve the Bukkit
ItemStackdirectly from the generated result, thenapply BlockRegen's parser to the existing
ItemMetavia the standardBukkit API. This preserves all metadata (including CustomModelData) while
still allowing BlockRegen placeholders in name and lore.
Reproduction