From 21bd518f4517516042e4ba83daa82fdb19a20d46 Mon Sep 17 00:00:00 2001 From: KennyTV <28825609+KennyTV@users.noreply.github.com> Date: Tue, 25 Jun 2019 12:34:01 +0200 Subject: [PATCH] Properly fix recipe book from 1.14.3 --- .../Protocol1_14_2To1_14_3.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_14_2to1_14_3/Protocol1_14_2To1_14_3.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_14_2to1_14_3/Protocol1_14_2To1_14_3.java index cc4d0f77..99cebe50 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_14_2to1_14_3/Protocol1_14_2To1_14_3.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_14_2to1_14_3/Protocol1_14_2To1_14_3.java @@ -52,12 +52,19 @@ public class Protocol1_14_2To1_14_3 extends BackwardsProtocol { @Override public void handle(PacketWrapper wrapper) throws Exception { int size = wrapper.passthrough(Type.VAR_INT); + int deleted = 0; for (int i = 0; i < size; i++) { String fullType = wrapper.read(Type.STRING); String type = fullType.replace("minecraft:", ""); String id = wrapper.read(Type.STRING); // id - if (type.equals("crafting_special_repairitem")) continue; // New type + if (type.equals("crafting_special_repairitem")) { + deleted++; + continue; + } + + wrapper.write(Type.STRING, fullType); + wrapper.write(Type.STRING, id); if (type.equals("crafting_shapeless")) { wrapper.passthrough(Type.STRING); // Group @@ -92,11 +99,9 @@ public class Protocol1_14_2To1_14_3 extends BackwardsProtocol { wrapper.passthrough(Type.FLOAT); // EXP wrapper.passthrough(Type.VAR_INT); // Cooking time } - - wrapper.write(Type.STRING, fullType); - wrapper.write(Type.STRING, id); } - wrapper.cancel(); + + wrapper.set(Type.VAR_INT, 0, size - deleted); } }); }