SPIGOT-6464: Fix ShulkerBox#getColor for undyed shulkers

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-05-23 08:30:36 +10:00
parent d8a90faeb1
commit 4d77463831

View file

@ -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<TileEntityShulkerBox> 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