SPIGOT-4307: Fix hacky API for banners on shields

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2018-08-26 19:18:56 +10:00
parent 3edc1cf4e0
commit 0a468a6738
2 changed files with 58 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.server.EnumColor;
@@ -30,7 +31,9 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
public void load(TileEntityBanner banner) {
super.load(banner);
base = DyeColor.getByWoolData((byte) banner.color.getColorIndex());
if (banner.color != null) {
base = DyeColor.getByWoolData((byte) banner.color.getColorIndex());
}
patterns = new ArrayList<Pattern>();
if (banner.patterns != null) {
@@ -48,6 +51,7 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
@Override
public void setBaseColor(DyeColor color) {
Preconditions.checkArgument(color != null, "color");
this.base = color;
}