SPIGOT-4004: Fix banner pattern colouring

This commit is contained in:
md_5 2018-07-15 23:18:42 +10:00
parent 60185a5616
commit b8ea9ec844

View File

@ -47,13 +47,13 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
NBTTagCompound entityTag = tag.getCompound("BlockEntityTag");
base = entityTag.hasKey(BASE.NBT) ? DyeColor.getByDyeData((byte) entityTag.getInt(BASE.NBT)) : null;
base = entityTag.hasKey(BASE.NBT) ? DyeColor.getByWoolData((byte) entityTag.getInt(BASE.NBT)) : null;
if (entityTag.hasKey(PATTERNS.NBT)) {
NBTTagList patterns = entityTag.getList(PATTERNS.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
for (int i = 0; i < Math.min(patterns.size(), 20); i++) {
NBTTagCompound p = patterns.getCompound(i);
this.patterns.add(new Pattern(DyeColor.getByDyeData((byte) p.getInt(COLOR.NBT)), PatternType.getByIdentifier(p.getString(PATTERN.NBT))));
this.patterns.add(new Pattern(DyeColor.getByWoolData((byte) p.getInt(COLOR.NBT)), PatternType.getByIdentifier(p.getString(PATTERN.NBT))));
}
}
}
@ -84,14 +84,14 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
NBTTagCompound entityTag = new NBTTagCompound();
if (base != null) {
entityTag.setInt(BASE.NBT, base.getDyeData());
entityTag.setInt(BASE.NBT, base.getWoolData());
}
NBTTagList newPatterns = new NBTTagList();
for (Pattern p : patterns) {
NBTTagCompound compound = new NBTTagCompound();
compound.setInt(COLOR.NBT, p.getColor().getDyeData());
compound.setInt(COLOR.NBT, p.getColor().getWoolData());
compound.setString(PATTERN.NBT, p.getPattern().getIdentifier());
newPatterns.add(compound);
}