-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
3132-Spigot-66f9d3c-40caacc (MC: 1.17)
-
Yes
In the 1.17 releases of Spigot, shields seem to longer be tied to its own BlockStateMeta, making customization of the shield's base color and banner patterns impossible.
On previous versions of Spigot, if one were to implement code such as:
import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.block.Banner; import org.bukkit.block.BlockState; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BlockStateMeta; public class TestShield extends ItemStack { public TestShield () { super (Material.SHIELD); // Creates a shield with a red base color BlockStateMeta blockStateMeta = (BlockStateMeta) this.getItemMeta(); BlockState blockState = blockStateMeta.getBlockState(); Banner banner = (Banner) blockState; banner.setBaseColor(DyeColor.RED); banner.update(); blockStateMeta.setBlockState(banner); this.setItemMeta(blockStateMeta ); } }
... one would expect to get a red shield upon generating this object in-game. However, running the same code at the 1.17 Spigot builds throws the following exception:
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.block.Block.getBlockData()" because the return value of "org.bukkit.craftbukkit.v1_17_R1.util.CraftMagicNumbers.getBlock(org.bukkit.Material)" is nulljava.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.block.Block.getBlockData()" because the return value of "org.bukkit.craftbukkit.v1_17_R1.util.CraftMagicNumbers.getBlock(org.bukkit.Material)" is null at org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaBlockState.getBlockState(CraftMetaBlockState.java:310) ~[spigot-1.17.jar:3132-Spigot-66f9d3c-40caacc]