Proper support for all item types in ItemTranslator

This commit is contained in:
FlorianMichael 2023-11-05 16:04:51 +01:00
parent 15913b98e9
commit 48aef1fd5b
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -62,14 +62,17 @@ public class ItemTranslator {
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);