Skip to content

Commit

Permalink
Proper support for all item types in ItemTranslator
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Nov 5, 2023
1 parent 15913b9 commit 48aef1f
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 48aef1f

Please sign in to comment.