From 00625be8905d93e539ea041dbda98d23bdb7dc6d Mon Sep 17 00:00:00 2001 From: EnZaXD <60033407+FlorianMichael@users.noreply.github.com> Date: Mon, 14 Aug 2023 02:46:30 +0200 Subject: [PATCH] Move 1.9 backwards protocols to VB and move Chunk Types to the correct package (#3404) --- .../protocol/ProtocolManagerImpl.java | 4 - .../Protocol1_10To1_9_3_4.java | 2 +- .../Protocol1_11To1_10.java | 2 +- .../Protocol1_12To1_11_1.java | 2 +- .../packets/WorldPackets.java | 4 +- .../Protocol1_9_1_2To1_9_3_4.java | 121 ------------------ .../chunks/BlockEntity.java | 84 ------------ .../types/Chunk1_9_1_2Type.java | 2 +- .../Protocol1_9_3To1_9_1_2.java | 4 +- .../types/Chunk1_9_3_4Type.java | 4 +- .../packets/WorldPackets.java | 2 +- .../protocol1_9to1_8/sounds/Effect.java | 4 +- .../Protocol1_9To1_9_1.java | 64 --------- 13 files changed, 13 insertions(+), 286 deletions(-) delete mode 100644 common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/Protocol1_9_1_2To1_9_3_4.java delete mode 100644 common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/chunks/BlockEntity.java rename common/src/main/java/com/viaversion/viaversion/protocols/{protocol1_9_3to1_9_1_2 => protocol1_9_1to1_9}/types/Chunk1_9_1_2Type.java (98%) rename common/src/main/java/com/viaversion/viaversion/protocols/{protocol1_9_1_2to1_9_3_4 => protocol1_9_3to1_9_1_2}/types/Chunk1_9_3_4Type.java (98%) delete mode 100644 common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_9_1/Protocol1_9To1_9_1.java diff --git a/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolManagerImpl.java b/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolManagerImpl.java index e89bf701e..cb01231af 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolManagerImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolManagerImpl.java @@ -72,11 +72,9 @@ import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.Protocol1_19_4 import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2; import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.Protocol1_20_2To1_20; import com.viaversion.viaversion.protocols.protocol1_20to1_19_4.Protocol1_20To1_19_4; -import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4; import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3To1_9_1_2; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; -import com.viaversion.viaversion.protocols.protocol1_9to1_9_1.Protocol1_9To1_9_1; import com.viaversion.viaversion.util.Pair; import io.netty.buffer.ByteBuf; import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap; @@ -142,8 +140,6 @@ public class ProtocolManagerImpl implements ProtocolManager { registerProtocol(new Protocol1_9_1To1_9(), Arrays.asList(ProtocolVersion.v1_9_1.getVersion(), ProtocolVersion.v1_9_2.getVersion()), ProtocolVersion.v1_9.getVersion()); registerProtocol(new Protocol1_9_3To1_9_1_2(), ProtocolVersion.v1_9_3, ProtocolVersion.v1_9_2); - registerProtocol(new Protocol1_9To1_9_1(), ProtocolVersion.v1_9, ProtocolVersion.v1_9_1); - registerProtocol(new Protocol1_9_1_2To1_9_3_4(), Arrays.asList(ProtocolVersion.v1_9_1.getVersion(), ProtocolVersion.v1_9_2.getVersion()), ProtocolVersion.v1_9_3.getVersion()); registerProtocol(new Protocol1_10To1_9_3_4(), ProtocolVersion.v1_10, ProtocolVersion.v1_9_3); registerProtocol(new Protocol1_11To1_10(), ProtocolVersion.v1_11, ProtocolVersion.v1_10); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java index 77933c326..0e2e02678 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_10to1_9_3/Protocol1_10To1_9_3_4.java @@ -31,9 +31,9 @@ import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.version.Types1_9; import com.viaversion.viaversion.protocols.protocol1_10to1_9_3.packets.InventoryPackets; import com.viaversion.viaversion.protocols.protocol1_10to1_9_3.storage.ResourcePackTracker; -import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; +import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java index 837a05e86..25641c75e 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_11to1_10/Protocol1_11To1_10.java @@ -33,9 +33,9 @@ import com.viaversion.viaversion.protocols.protocol1_11to1_10.data.PotionColorMa import com.viaversion.viaversion.protocols.protocol1_11to1_10.metadata.MetadataRewriter1_11To1_10; import com.viaversion.viaversion.protocols.protocol1_11to1_10.packets.InventoryPackets; import com.viaversion.viaversion.protocols.protocol1_11to1_10.storage.EntityTracker1_11; -import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; +import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import com.viaversion.viaversion.rewriter.SoundRewriter; import com.viaversion.viaversion.util.Pair; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_12to1_11_1/Protocol1_12To1_11_1.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_12to1_11_1/Protocol1_12To1_11_1.java index 4072b4c92..f481ce761 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_12to1_11_1/Protocol1_12To1_11_1.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_12to1_11_1/Protocol1_12To1_11_1.java @@ -40,9 +40,9 @@ import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.packets.Inventor import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.providers.InventoryQuickMoveProvider; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2; -import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; +import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; import com.viaversion.viaversion.rewriter.SoundRewriter; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java index 87ddaa8b2..94bc4fec6 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_13to1_12_2/packets/WorldPackets.java @@ -45,7 +45,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.BlockE import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PaintingProvider; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockStorage; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type; -import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type; +import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; @@ -58,7 +58,7 @@ public class WorldPackets { private static final IntSet VALID_BIOMES = new IntOpenHashSet(70, .99F); static { - // Client will crash if it receives a invalid biome id + // Client will crash if it receives an invalid biome id for (int i = 0; i < 50; i++) { VALID_BIOMES.add(i); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/Protocol1_9_1_2To1_9_3_4.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/Protocol1_9_1_2To1_9_3_4.java deleted file mode 100644 index b347fe0b5..000000000 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/Protocol1_9_1_2To1_9_3_4.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2023 ViaVersion and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4; - -import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.github.steveice10.opennbt.tag.builtin.StringTag; -import com.github.steveice10.opennbt.tag.builtin.Tag; -import com.viaversion.viaversion.api.connection.UserConnection; -import com.viaversion.viaversion.api.minecraft.Position; -import com.viaversion.viaversion.api.minecraft.chunks.Chunk; -import com.viaversion.viaversion.api.protocol.AbstractProtocol; -import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.chunks.BlockEntity; -import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_1_2Type; -import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9; -import com.viaversion.viaversion.protocols.protocol1_9to1_8.ServerboundPackets1_9; - -// Goes BACKWARDS from 1.9.3/4 to 1.9.1/2 -public class Protocol1_9_1_2To1_9_3_4 extends AbstractProtocol { - - public Protocol1_9_1_2To1_9_3_4() { - super(ClientboundPackets1_9_3.class, ClientboundPackets1_9.class, ServerboundPackets1_9_3.class, ServerboundPackets1_9.class); - } - - @Override - protected void registerPackets() { - registerClientbound(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, new PacketHandlers() { - @Override - public void register() { - map(Type.POSITION); //Position - map(Type.UNSIGNED_BYTE); //Type - map(Type.NBT); //NBT - handler(wrapper -> { - if (wrapper.get(Type.UNSIGNED_BYTE, 0) == 9) { - Position position = wrapper.get(Type.POSITION, 0); - CompoundTag tag = wrapper.get(Type.NBT, 0); - - wrapper.clearPacket(); //Clear the packet - - wrapper.setPacketType(ClientboundPackets1_9.UPDATE_SIGN); - wrapper.write(Type.POSITION, position); // Position - for (int i = 1; i < 5; i++) { - // Should technically be written as COMPONENT, but left as String for simplification/to remove redundant wrapping for VR - Tag textTag = tag.get("Text" + i); - String line = textTag instanceof StringTag ? ((StringTag) textTag).getValue() : ""; - wrapper.write(Type.STRING, line); // Sign line - } - } - }); - } - }); - - registerClientbound(ClientboundPackets1_9_3.CHUNK_DATA, wrapper -> { - ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); - - Chunk1_9_3_4Type newType = new Chunk1_9_3_4Type(clientWorld); - Chunk1_9_1_2Type oldType = new Chunk1_9_1_2Type(clientWorld); // Get the old type to not write Block Entities - - Chunk chunk = wrapper.read(newType); - wrapper.write(oldType, chunk); - BlockEntity.handle(chunk.getBlockEntities(), wrapper.user()); - }); - - registerClientbound(ClientboundPackets1_9_3.JOIN_GAME, new PacketHandlers() { - @Override - public void register() { - map(Type.INT); // 0 - Entity ID - map(Type.UNSIGNED_BYTE); // 1 - Gamemode - map(Type.INT); // 2 - Dimension - - handler(wrapper -> { - ClientWorld clientChunks = wrapper.user().get(ClientWorld.class); - - int dimensionId = wrapper.get(Type.INT, 1); - clientChunks.setEnvironment(dimensionId); - }); - } - }); - - registerClientbound(ClientboundPackets1_9_3.RESPAWN, new PacketHandlers() { - @Override - public void register() { - map(Type.INT); // 0 - Dimension ID - - handler(wrapper -> { - ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); - - int dimensionId = wrapper.get(Type.INT, 0); - clientWorld.setEnvironment(dimensionId); - }); - } - }); - } - - @Override - public void init(UserConnection userConnection) { - if (!userConnection.has(ClientWorld.class)) { - userConnection.put(new ClientWorld(userConnection)); - } - } -} diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/chunks/BlockEntity.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/chunks/BlockEntity.java deleted file mode 100644 index 6c4b5715f..000000000 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/chunks/BlockEntity.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2023 ViaVersion and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.chunks; - -import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.github.steveice10.opennbt.tag.builtin.NumberTag; -import com.viaversion.viaversion.api.Via; -import com.viaversion.viaversion.api.connection.UserConnection; -import com.viaversion.viaversion.api.minecraft.Position; -import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; -import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class BlockEntity { - private static final Map types = new HashMap<>(); - - static { - types.put("MobSpawner", 1); - types.put("Control", 2); - types.put("Beacon", 3); - types.put("Skull", 4); - types.put("FlowerPot", 5); - types.put("Banner", 6); - types.put("UNKNOWN", 7); - types.put("EndGateway", 8); - types.put("Sign", 9); - } - - public static void handle(List tags, UserConnection connection) { - for (CompoundTag tag : tags) { - try { - if (!tag.contains("id")) - throw new Exception("NBT tag not handled because the id key is missing"); - - String id = (String) tag.get("id").getValue(); - if (!types.containsKey(id)) - throw new Exception("Not handled id: " + id); - - int newId = types.get(id); - if (newId == -1) - continue; - - int x = ((NumberTag) tag.get("x")).asInt(); - int y = ((NumberTag) tag.get("y")).asInt(); - int z = ((NumberTag) tag.get("z")).asInt(); - - Position pos = new Position(x, (short) y, z); - - updateBlockEntity(pos, (short) newId, tag, connection); - } catch (Exception e) { - if (Via.getManager().isDebug()) { - Via.getPlatform().getLogger().warning("Block Entity: " + e.getMessage() + ": " + tag); - } - } - } - } - - private static void updateBlockEntity(Position pos, short id, CompoundTag tag, UserConnection connection) throws Exception { - PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, null, connection); - wrapper.write(Type.POSITION, pos); - wrapper.write(Type.UNSIGNED_BYTE, id); - wrapper.write(Type.NBT, tag); - wrapper.scheduleSend(Protocol1_9_1_2To1_9_3_4.class, false); - } -} diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/types/Chunk1_9_1_2Type.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1to1_9/types/Chunk1_9_1_2Type.java similarity index 98% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/types/Chunk1_9_1_2Type.java rename to common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1to1_9/types/Chunk1_9_1_2Type.java index 16693ed9b..cb58caa43 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/types/Chunk1_9_1_2Type.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1to1_9/types/Chunk1_9_1_2Type.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types; +package com.viaversion.viaversion.protocols.protocol1_9_1to1_9.types; import com.viaversion.viaversion.api.minecraft.Environment; import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java index 971c87e11..6ad987269 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/Protocol1_9_3To1_9_1_2.java @@ -32,10 +32,10 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type; +import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_3_4Type; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.chunks.FakeTileEntity; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_1_2Type; +import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.types.Chunk1_9_1_2Type; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ServerboundPackets1_9; import java.util.List; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/types/Chunk1_9_3_4Type.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/types/Chunk1_9_3_4Type.java similarity index 98% rename from common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/types/Chunk1_9_3_4Type.java rename to common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/types/Chunk1_9_3_4Type.java index 72b265046..549f421bb 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_1_2to1_9_3_4/types/Chunk1_9_3_4Type.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9_3to1_9_1_2/types/Chunk1_9_3_4Type.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.types; +package com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.api.Via; @@ -122,4 +122,4 @@ public class Chunk1_9_3_4Type extends PartialType { public Class getBaseClass() { return BaseChunkType.class; } -} +} \ No newline at end of file diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/WorldPackets.java index 2b2156092..e1666b073 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/packets/WorldPackets.java @@ -33,7 +33,7 @@ import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_8; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; -import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.types.Chunk1_9_1_2Type; +import com.viaversion.viaversion.protocols.protocol1_9_1to1_9.types.Chunk1_9_1_2Type; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ItemRewriter; import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/sounds/Effect.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/sounds/Effect.java index 35f008d72..a22754a69 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/sounds/Effect.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_8/sounds/Effect.java @@ -42,8 +42,8 @@ public class Effect { addRewrite(1020, 1029); //Anvil break addRewrite(1021, 1030); //Anvil use addRewrite(1022, 1031); //Anvil land - addRewrite(1013, 1023); - addRewrite(1018, 1028); + addRewrite(1013, 1023); //Wither spawn + addRewrite(1018, 1028); //EnderDragon end } public static int getNewId(int id) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_9_1/Protocol1_9To1_9_1.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_9_1/Protocol1_9To1_9_1.java deleted file mode 100644 index ef777e7cd..000000000 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_9to1_9_1/Protocol1_9To1_9_1.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2023 ViaVersion and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.viaversion.viaversion.protocols.protocol1_9to1_9_1; - -import com.viaversion.viaversion.api.protocol.AbstractProtocol; -import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9; -import com.viaversion.viaversion.protocols.protocol1_9to1_8.ServerboundPackets1_9; - -public class Protocol1_9To1_9_1 extends AbstractProtocol { - - public Protocol1_9To1_9_1() { - super(ClientboundPackets1_9.class, ClientboundPackets1_9.class, ServerboundPackets1_9.class, ServerboundPackets1_9.class); - } - - @Override - protected void registerPackets() { - registerClientbound(ClientboundPackets1_9.JOIN_GAME, new PacketHandlers() { - @Override - public void register() { - map(Type.INT); // 0 - Player ID - map(Type.UNSIGNED_BYTE); // 1 - Player Gamemode - // 1.9.1 PRE 2 Changed this - map(Type.INT, Type.BYTE); // 2 - Player Dimension - map(Type.UNSIGNED_BYTE); // 3 - World Difficulty - map(Type.UNSIGNED_BYTE); // 4 - Max Players (Tab) - map(Type.STRING); // 5 - Level Type - map(Type.BOOLEAN); // 6 - Reduced Debug info - } - }); - - registerClientbound(ClientboundPackets1_9.SOUND, new PacketHandlers() { - @Override - public void register() { - map(Type.VAR_INT); // 0 - Sound ID - - handler(wrapper -> { - int sound = wrapper.get(Type.VAR_INT, 0); - - if (sound == 415) // Stop the Elytra sound for 1.9 (It's introduced in 1.9.2) - wrapper.cancel(); - else if (sound >= 416) // Act like the Elytra sound never existed - wrapper.set(Type.VAR_INT, 0, sound - 1); - }); - } - }); - } -}