diff --git a/.travis.yml b/.travis.yml index b57cd3069..ce6c32a37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ sudo: false language: java jdk: - - oraclejdk8 - openjdk11 cache: diff --git a/README.md b/README.md index cc4b9c37b..8440ced50 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ViaVersion 2.1.1 - Spigot, Sponge, BungeeCord, Velocity +# ViaVersion 2.1.3 - Spigot, Sponge, BungeeCord, Velocity [![Build Status](https://travis-ci.com/ViaVersion/ViaVersion.svg?branch=master)](https://travis-ci.com/ViaVersion/ViaVersion) [![Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 041162ecf..e643bc718 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.3-SNAPSHOT + 2.1.4-SNAPSHOT 4.0.0 diff --git a/bungee/pom.xml b/bungee/pom.xml index 57fd5d83f..991a2f6df 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.3-SNAPSHOT + 2.1.4-SNAPSHOT 4.0.0 diff --git a/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java b/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java index 6f3cc1b81..f3c0a677a 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java +++ b/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java @@ -7,6 +7,7 @@ import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.event.EventHandler; +import net.md_5.bungee.protocol.ProtocolConstants; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.ViaAPI; import us.myles.ViaVersion.api.command.ViaCommandSender; @@ -35,6 +36,17 @@ public class BungeePlugin extends Plugin implements ViaPlatform, Listener { @Override public void onLoad() { + try { + ProtocolConstants.class.getField("MINECRAFT_1_14_4"); + } catch (NoSuchFieldException e) { + getLogger().warning(" / \\"); + getLogger().warning(" / \\"); + getLogger().warning(" / | \\"); + getLogger().warning(" / | \\ BUNGEECORD IS OUTDATED"); + getLogger().warning(" / \\ VIAVERSION MAY NOT WORK AS INTENDED"); + getLogger().warning(" / o \\"); + getLogger().warning("/_____________\\"); + } api = new BungeeViaAPI(); config = new BungeeViaConfig(getDataFolder()); commandHandler = new BungeeCommandHandler(); diff --git a/common/pom.xml b/common/pom.xml index 5fd695d26..997820086 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.3-SNAPSHOT + 2.1.4-SNAPSHOT 4.0.0 diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java index f8368bee1..bcc669765 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java @@ -19,6 +19,7 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2; import us.myles.ViaVersion.protocols.protocol1_14_1to1_14.Protocol1_14_1To1_14; import us.myles.ViaVersion.protocols.protocol1_14_2to1_14_1.Protocol1_14_2To1_14_1; import us.myles.ViaVersion.protocols.protocol1_14_3to1_14_2.Protocol1_14_3To1_14_2; +import us.myles.ViaVersion.protocols.protocol1_14_4to1_14_3.Protocol1_14_4To1_14_3; import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2; import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4; import us.myles.ViaVersion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9; @@ -61,13 +62,14 @@ public class ProtocolRegistry { registerProtocol(new Protocol1_12_2To1_12_1(), Collections.singletonList(ProtocolVersion.v1_12_2.getId()), ProtocolVersion.v1_12_1.getId()); registerProtocol(new Protocol1_13To1_12_2(), Collections.singletonList(ProtocolVersion.v1_13.getId()), ProtocolVersion.v1_12_2.getId()); - registerProtocol(new Protocol1_13_1To1_13(), Arrays.asList(ProtocolVersion.v1_13_1.getId()), ProtocolVersion.v1_13.getId()); - registerProtocol(new Protocol1_13_2To1_13_1(), Arrays.asList(ProtocolVersion.v1_13_2.getId()), ProtocolVersion.v1_13_1.getId()); + registerProtocol(new Protocol1_13_1To1_13(), Collections.singletonList(ProtocolVersion.v1_13_1.getId()), ProtocolVersion.v1_13.getId()); + registerProtocol(new Protocol1_13_2To1_13_1(), Collections.singletonList(ProtocolVersion.v1_13_2.getId()), ProtocolVersion.v1_13_1.getId()); - registerProtocol(new Protocol1_14To1_13_2(), Arrays.asList(ProtocolVersion.v1_14.getId()), ProtocolVersion.v1_13_2.getId()); - registerProtocol(new Protocol1_14_1To1_14(), Arrays.asList(ProtocolVersion.v1_14_1.getId()), ProtocolVersion.v1_14.getId()); - registerProtocol(new Protocol1_14_2To1_14_1(), Arrays.asList(ProtocolVersion.v1_14_2.getId()), ProtocolVersion.v1_14_1.getId()); - registerProtocol(new Protocol1_14_3To1_14_2(), Arrays.asList(ProtocolVersion.v1_14_3.getId()), ProtocolVersion.v1_14_2.getId()); + registerProtocol(new Protocol1_14To1_13_2(), Collections.singletonList(ProtocolVersion.v1_14.getId()), ProtocolVersion.v1_13_2.getId()); + registerProtocol(new Protocol1_14_1To1_14(), Collections.singletonList(ProtocolVersion.v1_14_1.getId()), ProtocolVersion.v1_14.getId()); + registerProtocol(new Protocol1_14_2To1_14_1(), Collections.singletonList(ProtocolVersion.v1_14_2.getId()), ProtocolVersion.v1_14_1.getId()); + registerProtocol(new Protocol1_14_3To1_14_2(), Collections.singletonList(ProtocolVersion.v1_14_3.getId()), ProtocolVersion.v1_14_2.getId()); + registerProtocol(new Protocol1_14_4To1_14_3(), Collections.singletonList(ProtocolVersion.v1_14_4.getId()), ProtocolVersion.v1_14_3.getId()); } /** diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java index 3bdda1e7e..8ac5bf385 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java @@ -39,6 +39,7 @@ public class ProtocolVersion { public static final ProtocolVersion v1_14_1; public static final ProtocolVersion v1_14_2; public static final ProtocolVersion v1_14_3; + public static final ProtocolVersion v1_14_4; public static final ProtocolVersion unknown; private final int id; @@ -74,6 +75,7 @@ public class ProtocolVersion { register(v1_14_1 = new ProtocolVersion(480, "1.14.1")); register(v1_14_2 = new ProtocolVersion(485, "1.14.2")); register(v1_14_3 = new ProtocolVersion(490, "1.14.3")); + register(v1_14_4 = new ProtocolVersion(498, "1.14.4")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java index a6766d2a6..53638d224 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/InventoryPackets.java @@ -27,6 +27,7 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.SpawnEggRewriter; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; +import java.util.Locale; public class InventoryPackets { private static String NBT_TAG_NAME; @@ -404,13 +405,13 @@ public class InventoryPackets { if (numberConverted != null) { oldId = numberConverted; } - String[] newValues = BlockIdData.blockIdMapping.get(oldId); + String[] newValues = BlockIdData.blockIdMapping.get(oldId.toLowerCase(Locale.ROOT)); if (newValues != null) { for (String newValue : newValues) { newCanPlaceOn.add(new StringTag("", newValue)); } } else { - newCanPlaceOn.add(new StringTag("", oldId)); + newCanPlaceOn.add(new StringTag("", oldId.toLowerCase(Locale.ROOT))); } } tag.put(newCanPlaceOn); @@ -426,13 +427,13 @@ public class InventoryPackets { if (numberConverted != null) { oldId = numberConverted; } - String[] newValues = BlockIdData.blockIdMapping.get(oldId); + String[] newValues = BlockIdData.blockIdMapping.get(oldId.toLowerCase(Locale.ROOT)); if (newValues != null) { for (String newValue : newValues) { newCanDestroy.add(new StringTag("", newValue)); } } else { - newCanDestroy.add(new StringTag("", oldId)); + newCanDestroy.add(new StringTag("", oldId.toLowerCase(Locale.ROOT))); } } tag.put(newCanDestroy); diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14_4to1_14_3/Protocol1_14_4To1_14_3.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14_4to1_14_3/Protocol1_14_4To1_14_3.java new file mode 100644 index 000000000..8c571275e --- /dev/null +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14_4to1_14_3/Protocol1_14_4To1_14_3.java @@ -0,0 +1,47 @@ +package us.myles.ViaVersion.protocols.protocol1_14_4to1_14_3; + +import us.myles.ViaVersion.api.PacketWrapper; +import us.myles.ViaVersion.api.data.UserConnection; +import us.myles.ViaVersion.api.protocol.Protocol; +import us.myles.ViaVersion.api.remapper.PacketHandler; +import us.myles.ViaVersion.api.remapper.PacketRemapper; +import us.myles.ViaVersion.api.type.Type; +import us.myles.ViaVersion.packets.State; + +public class Protocol1_14_4To1_14_3 extends Protocol { + + @Override + protected void registerPackets() { + // trade list + registerOutgoing(State.PLAY, 0x27, 0x27, new PacketRemapper() { + @Override + public void registerMap() { + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + wrapper.passthrough(Type.VAR_INT); + int size = wrapper.passthrough(Type.UNSIGNED_BYTE); + for (int i = 0; i < size; i++) { + wrapper.passthrough(Type.FLAT_VAR_INT_ITEM); + wrapper.passthrough(Type.FLAT_VAR_INT_ITEM); + if (wrapper.passthrough(Type.BOOLEAN)) { + wrapper.passthrough(Type.FLAT_VAR_INT_ITEM); + } + wrapper.passthrough(Type.BOOLEAN); + wrapper.passthrough(Type.INT); + wrapper.passthrough(Type.INT); + wrapper.passthrough(Type.INT); + wrapper.passthrough(Type.INT); + wrapper.passthrough(Type.FLOAT); + wrapper.write(Type.INT, 0); // demand value added in pre5 + } + } + }); + } + }); + } + + @Override + public void init(UserConnection userConnection) { + } +} diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java index 4cce427be..0de0ac2df 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java @@ -40,7 +40,6 @@ public class Protocol1_14To1_13_2 extends Protocol { registerOutgoing(State.PLAY, 0x1B, 0x1A); registerOutgoing(State.PLAY, 0x1C, 0x1B); registerOutgoing(State.PLAY, 0x1D, 0x54); - registerOutgoing(State.PLAY, 0x1E, 0x1C); registerOutgoing(State.PLAY, 0x1F, 0x1D); registerOutgoing(State.PLAY, 0x20, 0x1E); registerOutgoing(State.PLAY, 0x21, 0x20); diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java index 417cb149c..131915bcd 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java @@ -22,11 +22,18 @@ import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker1 import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; +import java.util.Arrays; + public class WorldPackets { private static final int AIR = MappingData.blockStateMappings.getNewId(0); private static final int VOID_AIR = MappingData.blockStateMappings.getNewId(8591); private static final int CAVE_AIR = MappingData.blockStateMappings.getNewId(8592); public static final int SERVERSIDE_VIEW_DISTANCE = 64; + private static final byte[] FULL_LIGHT = new byte[2048]; + + static { + Arrays.fill(FULL_LIGHT, (byte) 0xff); + } public static void register(final Protocol protocol) { @@ -116,6 +123,30 @@ public class WorldPackets { } }); + // Explosion + protocol.registerOutgoing(State.PLAY, 0x1E, 0x1C, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.FLOAT); // X + map(Type.FLOAT); // Y + map(Type.FLOAT); // Z + map(Type.FLOAT); // Radius + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + for (int i = 0; i < 3; i++) { + float coord = wrapper.get(Type.FLOAT, i); + + if (coord < 0f) { + coord = (int) coord; + wrapper.set(Type.FLOAT, i, coord); + } + } + } + }); + } + }); + // Chunk protocol.registerOutgoing(State.PLAY, 0x22, 0x21, new PacketRemapper() { @Override @@ -172,24 +203,39 @@ public class WorldPackets { PacketWrapper lightPacket = wrapper.create(0x24); lightPacket.write(Type.VAR_INT, chunk.getX()); lightPacket.write(Type.VAR_INT, chunk.getZ()); - int skyLightMask = 0; + + int skyLightMask = chunk.isGroundUp() ? 0x3ffff : 0; // all 18 bits set if ground up int blockLightMask = 0; for (int i = 0; i < chunk.getSections().length; i++) { ChunkSection sec = chunk.getSections()[i]; if (sec == null) continue; - if (sec.hasSkyLight()) { + if (!chunk.isGroundUp() && sec.hasSkyLight()) { skyLightMask |= (1 << (i + 1)); } blockLightMask |= (1 << (i + 1)); } + lightPacket.write(Type.VAR_INT, skyLightMask); lightPacket.write(Type.VAR_INT, blockLightMask); lightPacket.write(Type.VAR_INT, 0); // empty sky light mask lightPacket.write(Type.VAR_INT, 0); // empty block light mask + + // not sending skylight/setting empty skylight causes client lag due to some weird calculations + // only do this on the initial chunk send (not when chunk.isGroundUp() is false) + if (chunk.isGroundUp()) + lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(FULL_LIGHT).toArray(new Byte[0])); // chunk below 0 for (ChunkSection section : chunk.getSections()) { - if (section == null || !section.hasSkyLight()) continue; + if (section == null || !section.hasSkyLight()) { + if (chunk.isGroundUp()) { + lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(FULL_LIGHT).toArray(new Byte[0])); + } + continue; + } lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(section.getSkyLight()).toArray(new Byte[0])); } + if (chunk.isGroundUp()) + lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(FULL_LIGHT).toArray(new Byte[0])); // chunk above 255 + for (ChunkSection section : chunk.getSections()) { if (section == null) continue; lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(section.getBlockLight()).toArray(new Byte[0])); diff --git a/jar/pom.xml b/jar/pom.xml index 838a9165f..66207d352 100644 --- a/jar/pom.xml +++ b/jar/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.3-SNAPSHOT + 2.1.4-SNAPSHOT 4.0.0 viaversion-jar diff --git a/pom.xml b/pom.xml index 89452e195..e8e559df6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ us.myles viaversion-parent - 2.1.3-SNAPSHOT + 2.1.4-SNAPSHOT pom viaversion-parent diff --git a/sponge-legacy/pom.xml b/sponge-legacy/pom.xml index 193a1fad8..52f32ac2d 100644 --- a/sponge-legacy/pom.xml +++ b/sponge-legacy/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.3-SNAPSHOT + 2.1.4-SNAPSHOT 4.0.0 diff --git a/sponge/pom.xml b/sponge/pom.xml index 68573394d..50b76c8f7 100644 --- a/sponge/pom.xml +++ b/sponge/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.3-SNAPSHOT + 2.1.4-SNAPSHOT 4.0.0 diff --git a/velocity/pom.xml b/velocity/pom.xml index cc941faa8..67d34d8db 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -5,7 +5,7 @@ viaversion-parent us.myles - 2.1.3-SNAPSHOT + 2.1.4-SNAPSHOT 4.0.0