From 4d7746383130d15c7bb4fecb5060f6c29598ad89 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 23 May 2021 08:30:36 +1000 Subject: [PATCH] SPIGOT-6464: Fix ShulkerBox#getColor for undyed shulkers By: md_5 --- .../java/org/bukkit/craftbukkit/block/CraftShulkerBox.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java index e9c8ce7a1e..fcf2a18107 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block; import net.minecraft.sounds.SoundCategory; import net.minecraft.sounds.SoundEffects; +import net.minecraft.world.item.EnumColor; import net.minecraft.world.level.World; import net.minecraft.world.level.block.BlockShulkerBox; import net.minecraft.world.level.block.entity.TileEntityShulkerBox; @@ -39,9 +40,9 @@ public class CraftShulkerBox extends CraftLootable impleme @Override public DyeColor getColor() { - net.minecraft.world.level.block.Block block = CraftMagicNumbers.getBlock(this.getType()); + EnumColor color = ((BlockShulkerBox) CraftMagicNumbers.getBlock(this.getType())).color; - return DyeColor.getByWoolData((byte) ((BlockShulkerBox) block).color.getColorIndex()); + return (color == null) ? null : DyeColor.getByWoolData((byte) color.getColorIndex()); } @Override