From e9ad3720390fe8a124289a99a4b95004fb039b66 Mon Sep 17 00:00:00 2001 From: Myles Date: Sun, 29 Jul 2018 11:48:38 +0100 Subject: [PATCH] Remap negative ids to air (workaround for #933) --- .../protocol1_13to1_12_2/packets/WorldPackets.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java index c31b47278..20d59fc34 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java @@ -14,8 +14,6 @@ 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; -import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type; -import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.ParticleRewriter; @@ -23,6 +21,8 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.BlockEntityP import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.PaintingProvider; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockStorage; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type; +import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type; +import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import java.util.List; @@ -276,6 +276,9 @@ public class WorldPackets { } public static int toNewId(int oldId) { + if (oldId < 0) { + oldId = 0; // Some plugins use negative numbers to clear blocks, remap them to air. + } Integer newId = MappingData.blockMappings.getNewBlock(oldId); if (newId != null) { return newId;