From cd230b601dd573543e52900015317ad9e72aef26 Mon Sep 17 00:00:00 2001 From: Marco Neuhaus Date: Sat, 16 Feb 2019 00:00:05 +0100 Subject: [PATCH] add dummy enchantments for 1.13 enchatments --- .../packets/BlockItemPackets1_13.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java index b845433c..7fa67106 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java @@ -634,6 +634,7 @@ public class BlockItemPackets1_13 extends BlockItemRewriter lore = new ArrayList<>(); + boolean dummyEnchatment = true; for (Tag enchantmentEntry : enchantments) { if (enchantmentEntry instanceof CompoundTag) { CompoundTag enchEntry = new CompoundTag(""); @@ -642,6 +643,7 @@ public class BlockItemPackets1_13 extends BlockItemRewriter 0) { + ByteTag hideFlags = tag.get("HideFlags"); + if(hideFlags == null){ + hideFlags = new ByteTag("HideFlags"); + tag.put(new ByteTag(NBT_TAG_NAME + "|noHideFlags")); + } + tag.put(new ByteTag(NBT_TAG_NAME + "|dummyEnchatment", hideFlags.getValue())); + + CompoundTag enchEntry = new CompoundTag(""); + enchEntry.put(new ShortTag("id", (short) 0)); + enchEntry.put(new ShortTag("lvl", (short) 1)); + + byte value = hideFlags.getValue(); + hideFlags.setValue(value |= 1); + tag.put(hideFlags); + + ench.add(enchEntry); + } tag.remove("Enchantment"); tag.put(noMapped); tag.put(ench); @@ -864,10 +884,28 @@ public class BlockItemPackets1_13 extends BlockItemRewriter