From 7ad59b7cb0971797e5ae1bf15eb7f95dc17b2ead Mon Sep 17 00:00:00 2001 From: creeper123123321 Date: Wed, 18 Jul 2018 15:23:46 -0300 Subject: [PATCH] Fix banner items --- .../packets/InventoryPackets.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java index f451158d7..544d55726 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java @@ -281,13 +281,21 @@ public class InventoryPackets { // NBT Changes if (tag != null) { // Invert shield color id - if (item.getId() == 442) { + if (item.getId() == 442 || item.getId() == 425) { if (tag.get("BlockEntityTag") instanceof CompoundTag) { CompoundTag blockEntityTag = tag.get("BlockEntityTag"); if (blockEntityTag.get("Base") instanceof IntTag) { IntTag base = blockEntityTag.get("Base"); base.setValue(15 - base.getValue()); } + if (blockEntityTag.get("Patterns") instanceof ListTag) { + for (Tag pattern : (ListTag) blockEntityTag.get("Patterns")) { + if (pattern instanceof CompoundTag) { + IntTag c = ((CompoundTag) pattern).get("Color"); + c.setValue(15 - c.getValue()); // Invert color id + } + } + } } } // Display Name now uses JSON @@ -426,14 +434,23 @@ public class InventoryPackets { } } - if (item.getId() == 442) { // shield + if (item.getId() == 442 || item.getId() == 425) { // shield / banner if (tag.get("BlockEntityTag") instanceof CompoundTag) { CompoundTag blockEntityTag = tag.get("BlockEntityTag"); if (blockEntityTag.get("Base") instanceof IntTag) { IntTag base = blockEntityTag.get("Base"); base.setValue(15 - base.getValue()); // invert color id } + if (blockEntityTag.get("Patterns") instanceof ListTag) { + for (Tag pattern : (ListTag) blockEntityTag.get("Patterns")) { + if (pattern instanceof CompoundTag) { + IntTag c = ((CompoundTag) pattern).get("Color"); + c.setValue(15 - c.getValue()); // Invert color id + } + } + } } + } // Display Name now uses JSON