From 2c66e21268d061d584341d0587e766f9ddead42e Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 19 May 2019 20:47:05 +0200 Subject: [PATCH] fix more problems --- .../Protocol1_13_2To1_14.java | 27 +++++++++++++++++++ .../packets/BlockItemPackets1_14.java | 12 +++++++-- .../packets/EntityPackets1_14.java | 13 +++++---- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java index 6440bd70..6c29383f 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java @@ -39,6 +39,8 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol { registerOutgoing(State.PLAY, 0x17, 0x18); + registerOutgoing(State.PLAY, 0x18, 0x19); + registerOutgoing(State.PLAY, 0x19, 0x1A); registerOutgoing(State.PLAY, 0x1A, 0x1B); registerOutgoing(State.PLAY, 0x1B, 0x1C); @@ -90,6 +92,31 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol { registerOutgoing(State.PLAY, 0x55, 0x4F); // c registerOutgoing(State.PLAY, 0x56, 0x50); // c + //Update View Position + registerOutgoing(State.PLAY, 0x40, -1, new PacketRemapper() { + @Override + public void registerMap() { + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper packetWrapper) throws Exception { + packetWrapper.cancel(); + } + }); + } + }); + //Update View Distance + registerOutgoing(State.PLAY, 0x41, -1, new PacketRemapper() { + @Override + public void registerMap() { + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper packetWrapper) throws Exception { + packetWrapper.cancel(); + } + }); + } + }); + registerOutgoing(State.PLAY, 0x57, 0x51, new PacketRemapper() { // c @Override public void registerMap() { diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java index 10b7ea01..deb5f193 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java @@ -26,11 +26,18 @@ import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag; import us.myles.viaversion.libs.opennbt.tag.builtin.StringTag; import us.myles.viaversion.libs.opennbt.tag.builtin.Tag; +import java.util.Arrays; import java.util.Set; public class BlockItemPackets1_14 extends BlockItemRewriter { private static String NBT_TAG_NAME = "ViaBackwards|" + Protocol1_13_2To1_14.class.getSimpleName(); + private static byte[] fullLight = new byte[2048]; + + static { + Arrays.fill(fullLight, (byte) 0xFF); + } + @Override protected void registerPackets(Protocol1_13_2To1_14 protocol) { // Open window @@ -415,9 +422,10 @@ public class BlockItemPackets1_14 extends BlockItemRewriter { @Override public void handle(PacketWrapper wrapper) throws Exception { for (int entity : wrapper.get(Type.VAR_INT_ARRAY, 0)) - wrapper.user().get(EntityTracker.class).removeEntity(entity); + wrapper.user().get(EntityTracker.class).get(protocol).removeEntity(entity); } }); } @@ -280,6 +280,8 @@ public class EntityPackets1_14 extends EntityRewriter { wrapper.write(Type.UNSIGNED_BYTE, (short) 0); + wrapper.passthrough(Type.UNSIGNED_BYTE); // Max Players + wrapper.passthrough(Type.STRING); // Level Type wrapper.read(Type.VAR_INT); //Read View Distance } }); @@ -313,9 +315,10 @@ public class EntityPackets1_14 extends EntityRewriter { if (e.getIndex() > 6) e.getData().setId(e.getIndex() - 1); return e.getData(); }); - registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 13).removed(); - registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 14).removed(); - registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 15).removed(); + registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 17).removed(); + registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 18).removed(); + registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 19).removed(); + registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 20).removed(); // Villager data -> var int registerMetaHandler().handle(e -> { if (e.getData().getValue() instanceof VillagerData) {