From 85a5ae44e19ca3cb483955d51ebf1d4ade32b98c Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Wed, 22 May 2019 18:35:20 +0200 Subject: [PATCH] Fix minecarts --- .../packets/EntityPackets1_14.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java index 2a136819..0a8002d6 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/EntityPackets1_14.java @@ -67,7 +67,36 @@ public class EntityPackets1_14 extends EntityRewriter { public void handle(PacketWrapper wrapper) throws Exception { int id = wrapper.get(Type.BYTE, 0); EntityType1_13.EntityType entityType = EntityType1_13.getTypeFromId(EntityTypeMapping.getOldId(id).orElse(id), false); - Optional type = EntityType1_13.ObjectType.fromEntityType(entityType); + Optional type; + if (entityType.isOrHasParent(EntityType1_13.EntityType.MINECART_ABSTRACT)) { + type = Optional.of(EntityType1_13.ObjectType.MINECART); + int data = 0; + switch (entityType) { + case CHEST_MINECART: + data = 1; + break; + case FURNACE_MINECART: + data = 2; + break; + case TNT_MINECART: + data = 3; + break; + case SPAWNER_MINECART: + data = 4; + break; + case HOPPER_MINECART: + data = 5; + break; + case COMMANDBLOCK_MINECART: + data = 6; + break; + } + if (data != 0) + wrapper.set(Type.INT, 0, data); + } else { + type = EntityType1_13.ObjectType.fromEntityType(entityType); + } + if (type.isPresent()) { wrapper.set(Type.BYTE, 0, (byte) type.get().getId()); }