[SPIGOT-6033] Bukkit.getUnsafe().getMaterial() won't match renamed block materials Created: 27/Jul/20  Updated: 28/Jul/20  Resolved: 28/Jul/20

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

Type: New Feature Priority: Minor
Reporter: Black Hole Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Version: 1.16.1 API
Guidelines Read: Yes

 Description   

While updating some material names store by a plugin I found an issue with renamed materials that don't have an item form.
I'm using Bukkit.getUnsafe().getMaterial(oldMaterialName, 1631)
1631 is the data version of 1.13.2. The implementation CraftMagicNumbers.getMaterial() is using an item stack to call the Minecraft data fixer to rename the material.
The data fixer will ignore invalid ids, so block ids that are not renamed stay as they are. getMaterial will match the converted id with the Material enum. That won't work for wall_sign and the method returns null instead of oak_wall_sign.

I really don't understand how to call those data fixers to rename block materials.

Those materials have been renamed after 1.13:
cactus_green -> green_dye
dandelion_yellow -> yellow_dye
rose_red -> red_dye
sign -> oak_sign
stone_slab -> smooth_stone_slab
wall_sign -> null (should be oak_wall_sign)
zombie_pigman_spawn_egg -> zombified_piglin_spawn_egg

 


Generated at Sat Dec 13 13:37:40 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.