From 48aef1fd5bfda2c90ca05c4f6c7dfe991dbe025f Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Sun, 5 Nov 2023 16:04:51 +0100 Subject: [PATCH] Proper support for all item types in ItemTranslator --- .../protocolhack/util/ItemTranslator.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ItemTranslator.java b/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ItemTranslator.java index e44b336d4..47699776c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ItemTranslator.java +++ b/src/main/java/de/florianmichael/viafabricplus/protocolhack/util/ItemTranslator.java @@ -62,14 +62,17 @@ public static Item MC_TO_VIA_LATEST_TO_TARGET(final ItemStack stack, final Versi wrapper.apply(Direction.SERVERBOUND, State.PLAY, 0, protocolPath.stream().map(ProtocolPathEntry::protocol).collect(Collectors.toList())); wrapper.read(Type.SHORT); + if (targetVersion.isOlderThanOrEqualTo(VersionEnum.b1_8tob1_8_1)) { return wrapper.read(Typesb1_8_0_1.CREATIVE_ITEM); + } else if (targetVersion.isOlderThan(VersionEnum.r1_13)) { + return wrapper.read(Type.ITEM1_8); + } else if (targetVersion.isOlderThan(VersionEnum.r1_13_2)) { + return wrapper.read(Type.ITEM1_13); + } else if (targetVersion.isOlderThanOrEqualTo(VersionEnum.r1_20_2)) { + return wrapper.read(Type.ITEM1_13_2); } else { - if (wrapper.is(Type.ITEM1_13_2, 0)) { - return wrapper.read(Type.ITEM1_13_2); - } else { - return wrapper.read(Type.ITEM1_8); - } + return wrapper.read(Type.ITEM1_20_2); } } catch (Exception e) { ViaFabricPlus.LOGGER.error("Failed to translate item", e);