From e3b6c0f9c9780726b2413227d763a6e9b0dc77c6 Mon Sep 17 00:00:00 2001 From: Beanes Date: Fri, 19 Jun 2026 19:05:05 +0200 Subject: [PATCH 1/3] Use gray color for elytra --- .../rewriter/BlockItemPacketRewriter1_9.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java b/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java index af91a19a3..986b5a26e 100644 --- a/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java +++ b/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java @@ -19,6 +19,7 @@ import com.viaversion.nbt.tag.ByteTag; import com.viaversion.nbt.tag.CompoundTag; +import com.viaversion.nbt.tag.IntTag; import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.StringTag; import com.viaversion.nbt.tag.Tag; @@ -194,6 +195,7 @@ protected void registerRewrites() { @Override public Item handleItemToClient(UserConnection connection, Item item) { if (item == null) return null; + final int originalId = item.identifier(); super.handleItemToClient(connection, item); CompoundTag tag = item.tag(); @@ -280,6 +282,18 @@ public Item handleItemToClient(UserConnection connection, Item item) { }); } + // Colors the fake leather armor for an elytra gray + if (originalId == 443) { + if (tag == null) { + item.setTag(tag = new CompoundTag()); + } + CompoundTag display = tag.getCompoundTag("display"); + if (display == null) { + tag.put("display", display = new CompoundTag()); + } + display.put("color", new IntTag(0x737373)); // Grey + } + return item; } @@ -290,6 +304,14 @@ public Item handleItemToServer(UserConnection connection, Item item) { CompoundTag tag = item.tag(); + // Removes the gray color code from the fake leather armor for an elytra + if (item.identifier() == 443 && tag != null) { + final CompoundTag display = tag.getCompoundTag("display"); + if (display != null) { + display.remove("color"); + } + } + enchantmentRewriter.handleToServer(item); if (item.identifier() == 383 && item.data() != 0) { // Spawn eggs From 389c51a46f6d23358ede3b02c14025a396c84136 Mon Sep 17 00:00:00 2001 From: Beanes Date: Fri, 19 Jun 2026 19:24:37 +0200 Subject: [PATCH 2/3] Make fake banner of shield brown --- .../rewriter/BlockItemPacketRewriter1_9.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java b/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java index 986b5a26e..f8935bfd3 100644 --- a/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java +++ b/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java @@ -291,7 +291,16 @@ public Item handleItemToClient(UserConnection connection, Item item) { if (display == null) { tag.put("display", display = new CompoundTag()); } - display.put("color", new IntTag(0x737373)); // Grey + display.put("color", new IntTag(0x737373)); // Gray + } + + // Makes the fake banner for a shield brown if it has no banner patterns + if (originalId == 442) { + final CompoundTag blockEntityTag = tag == null ? null : tag.getCompoundTag("BlockEntityTag"); + final ListTag patterns = blockEntityTag == null ? null : blockEntityTag.getListTag("Patterns", CompoundTag.class); + if (patterns == null || patterns.isEmpty()) { + item.setData((short) 3); // Brown + } } return item; From bd777ba0137cb784562ea8b91d012734b764a859 Mon Sep 17 00:00:00 2001 From: Beanes Date: Fri, 19 Jun 2026 21:37:01 +0200 Subject: [PATCH 3/3] Properly guard item changes --- .../rewriter/BlockItemPacketRewriter1_9.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java b/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java index f8935bfd3..9b6f4d6f3 100644 --- a/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java +++ b/common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java @@ -292,6 +292,7 @@ public Item handleItemToClient(UserConnection connection, Item item) { tag.put("display", display = new CompoundTag()); } display.put("color", new IntTag(0x737373)); // Gray + tag.put(nbtTagName() + "|elytra_color", new ByteTag(true)); } // Makes the fake banner for a shield brown if it has no banner patterns @@ -300,6 +301,10 @@ public Item handleItemToClient(UserConnection connection, Item item) { final ListTag patterns = blockEntityTag == null ? null : blockEntityTag.getListTag("Patterns", CompoundTag.class); if (patterns == null || patterns.isEmpty()) { item.setData((short) 3); // Brown + if (tag == null) { + item.setTag(tag = new CompoundTag()); + } + tag.put(nbtTagName() + "|shield_color", new ByteTag(true)); } } @@ -314,13 +319,18 @@ public Item handleItemToServer(UserConnection connection, Item item) { CompoundTag tag = item.tag(); // Removes the gray color code from the fake leather armor for an elytra - if (item.identifier() == 443 && tag != null) { + if (tag != null && tag.remove(nbtTagName() + "|elytra_color") != null) { final CompoundTag display = tag.getCompoundTag("display"); if (display != null) { display.remove("color"); } } + // Restores the original data of a shield whose banner color was changed to brown + if (tag != null && tag.remove(nbtTagName() + "|shield_color") != null) { + item.setData((short) 0); + } + enchantmentRewriter.handleToServer(item); if (item.identifier() == 383 && item.data() != 0) { // Spawn eggs