Search in sources :

Example 1 with Protocol1_13To1_12_2

use of com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2 in project ViaVersion by ViaVersion.

the class WorldPackets method register.

public static void register(Protocol protocol) {
    // Outgoing packets
    protocol.registerClientbound(ClientboundPackets1_12_1.SPAWN_PAINTING, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Entity ID
            map(Type.VAR_INT);
            // 1 - Entity UUID
            map(Type.UUID);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    PaintingProvider provider = Via.getManager().getProviders().get(PaintingProvider.class);
                    String motive = wrapper.read(Type.STRING);
                    Optional<Integer> id = provider.getIntByIdentifier(motive);
                    if (!id.isPresent() && (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug())) {
                        Via.getPlatform().getLogger().warning("Could not find painting motive: " + motive + " falling back to default (0)");
                    }
                    wrapper.write(Type.VAR_INT, id.orElse(0));
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_ENTITY_DATA, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Location
            map(Type.POSITION);
            // 1 - Action
            map(Type.UNSIGNED_BYTE);
            // 2 - NBT data
            map(Type.NBT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    Position position = wrapper.get(Type.POSITION, 0);
                    short action = wrapper.get(Type.UNSIGNED_BYTE, 0);
                    CompoundTag tag = wrapper.get(Type.NBT, 0);
                    BlockEntityProvider provider = Via.getManager().getProviders().get(BlockEntityProvider.class);
                    int newId = provider.transform(wrapper.user(), position, tag, true);
                    if (newId != -1) {
                        BlockStorage storage = wrapper.user().get(BlockStorage.class);
                        BlockStorage.ReplacementData replacementData = storage.get(position);
                        if (replacementData != null) {
                            replacementData.setReplacement(newId);
                        }
                    }
                    if (action == 5) {
                        // Set type of flower in flower pot
                        // Removed
                        wrapper.cancel();
                    }
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_ACTION, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Location
            map(Type.POSITION);
            // Action Id
            map(Type.UNSIGNED_BYTE);
            // Action param
            map(Type.UNSIGNED_BYTE);
            // Block Id - /!\ NOT BLOCK STATE ID
            map(Type.VAR_INT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    Position pos = wrapper.get(Type.POSITION, 0);
                    short action = wrapper.get(Type.UNSIGNED_BYTE, 0);
                    short param = wrapper.get(Type.UNSIGNED_BYTE, 1);
                    int blockId = wrapper.get(Type.VAR_INT, 0);
                    if (blockId == 25)
                        blockId = 73;
                    else if (blockId == 33)
                        blockId = 99;
                    else if (blockId == 29)
                        blockId = 92;
                    else if (blockId == 54)
                        blockId = 142;
                    else if (blockId == 146)
                        blockId = 305;
                    else if (blockId == 130)
                        blockId = 249;
                    else if (blockId == 138)
                        blockId = 257;
                    else if (blockId == 52)
                        blockId = 140;
                    else if (blockId == 209)
                        blockId = 472;
                    else if (blockId >= 219 && blockId <= 234)
                        blockId = blockId - 219 + 483;
                    if (blockId == 73) {
                        // Note block
                        // block change
                        PacketWrapper blockChange = wrapper.create(0x0B);
                        blockChange.write(Type.POSITION, pos);
                        blockChange.write(Type.VAR_INT, 249 + (action * 24 * 2) + (param * 2));
                        blockChange.send(Protocol1_13To1_12_2.class);
                    }
                    wrapper.set(Type.VAR_INT, 0, blockId);
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_CHANGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.POSITION);
            map(Type.VAR_INT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    Position position = wrapper.get(Type.POSITION, 0);
                    int newId = toNewId(wrapper.get(Type.VAR_INT, 0));
                    UserConnection userConnection = wrapper.user();
                    if (Via.getConfig().isServersideBlockConnections()) {
                        ConnectionData.updateBlockStorage(userConnection, position.x(), position.y(), position.z(), newId);
                        newId = ConnectionData.connect(userConnection, position, newId);
                    }
                    wrapper.set(Type.VAR_INT, 0, checkStorage(wrapper.user(), position, newId));
                    if (Via.getConfig().isServersideBlockConnections()) {
                        // Workaround for packet order issue
                        wrapper.send(Protocol1_13To1_12_2.class);
                        wrapper.cancel();
                        ConnectionData.update(userConnection, position);
                    }
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.MULTI_BLOCK_CHANGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Chunk X
            map(Type.INT);
            // 1 - Chunk Z
            map(Type.INT);
            // 2 - Records
            map(Type.BLOCK_CHANGE_RECORD_ARRAY);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int chunkX = wrapper.get(Type.INT, 0);
                    int chunkZ = wrapper.get(Type.INT, 1);
                    UserConnection userConnection = wrapper.user();
                    BlockChangeRecord[] records = wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0);
                    // Convert ids
                    for (BlockChangeRecord record : records) {
                        int newBlock = toNewId(record.getBlockId());
                        Position position = new Position(record.getSectionX() + (chunkX * 16), record.getY(), record.getSectionZ() + (chunkZ * 16));
                        if (Via.getConfig().isServersideBlockConnections()) {
                            ConnectionData.updateBlockStorage(userConnection, position.x(), position.y(), position.z(), newBlock);
                        }
                        record.setBlockId(checkStorage(wrapper.user(), position, newBlock));
                    }
                    if (Via.getConfig().isServersideBlockConnections()) {
                        for (BlockChangeRecord record : records) {
                            int blockState = record.getBlockId();
                            Position position = new Position(record.getSectionX() + (chunkX * 16), record.getY(), record.getSectionZ() + (chunkZ * 16));
                            ConnectionHandler handler = ConnectionData.getConnectionHandler(blockState);
                            if (handler != null) {
                                blockState = handler.connect(userConnection, position, blockState);
                                record.setBlockId(blockState);
                            }
                        }
                        // Workaround for packet order issue
                        wrapper.send(Protocol1_13To1_12_2.class);
                        wrapper.cancel();
                        for (BlockChangeRecord record : records) {
                            Position position = new Position(record.getSectionX() + (chunkX * 16), record.getY(), record.getSectionZ() + (chunkZ * 16));
                            ConnectionData.update(userConnection, position);
                        }
                    }
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.EXPLOSION, new PacketRemapper() {

        @Override
        public void registerMap() {
            if (!Via.getConfig().isServersideBlockConnections())
                return;
            // X
            map(Type.FLOAT);
            // Y
            map(Type.FLOAT);
            // Z
            map(Type.FLOAT);
            // Radius
            map(Type.FLOAT);
            // Record Count
            map(Type.INT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    UserConnection userConnection = wrapper.user();
                    int x = (int) Math.floor(wrapper.get(Type.FLOAT, 0));
                    int y = (int) Math.floor(wrapper.get(Type.FLOAT, 1));
                    int z = (int) Math.floor(wrapper.get(Type.FLOAT, 2));
                    int recordCount = wrapper.get(Type.INT, 0);
                    Position[] records = new Position[recordCount];
                    for (int i = 0; i < recordCount; i++) {
                        Position position = new Position(x + wrapper.passthrough(Type.BYTE), (short) (y + wrapper.passthrough(Type.BYTE)), z + wrapper.passthrough(Type.BYTE));
                        records[i] = position;
                        // Set to air
                        ConnectionData.updateBlockStorage(userConnection, position.x(), position.y(), position.z(), 0);
                    }
                    // Workaround for packet order issue
                    wrapper.send(Protocol1_13To1_12_2.class);
                    wrapper.cancel();
                    for (int i = 0; i < recordCount; i++) {
                        ConnectionData.update(userConnection, records[i]);
                    }
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.UNLOAD_CHUNK, new PacketRemapper() {

        @Override
        public void registerMap() {
            if (Via.getConfig().isServersideBlockConnections()) {
                handler(new PacketHandler() {

                    @Override
                    public void handle(PacketWrapper wrapper) throws Exception {
                        int x = wrapper.passthrough(Type.INT);
                        int z = wrapper.passthrough(Type.INT);
                        ConnectionData.blockConnectionProvider.unloadChunk(wrapper.user(), x, z);
                    }
                });
            }
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.NAMED_SOUND, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.STRING);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    String sound = wrapper.get(Type.STRING, 0).replace("minecraft:", "");
                    String newSoundId = NamedSoundRewriter.getNewId(sound);
                    wrapper.set(Type.STRING, 0, newSoundId);
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.CHUNK_DATA, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
                    BlockStorage storage = wrapper.user().get(BlockStorage.class);
                    Chunk1_9_3_4Type type = new Chunk1_9_3_4Type(clientWorld);
                    Chunk1_13Type type1_13 = new Chunk1_13Type(clientWorld);
                    Chunk chunk = wrapper.read(type);
                    wrapper.write(type1_13, chunk);
                    for (int i = 0; i < chunk.getSections().length; i++) {
                        ChunkSection section = chunk.getSections()[i];
                        if (section == null)
                            continue;
                        for (int p = 0; p < section.getPaletteSize(); p++) {
                            int old = section.getPaletteEntry(p);
                            int newId = toNewId(old);
                            section.setPaletteEntry(p, newId);
                        }
                        boolean willSaveToStorage = false;
                        for (int p = 0; p < section.getPaletteSize(); p++) {
                            int newId = section.getPaletteEntry(p);
                            if (storage.isWelcome(newId)) {
                                willSaveToStorage = true;
                                break;
                            }
                        }
                        boolean willSaveConnection = false;
                        if (Via.getConfig().isServersideBlockConnections() && ConnectionData.needStoreBlocks()) {
                            for (int p = 0; p < section.getPaletteSize(); p++) {
                                int newId = section.getPaletteEntry(p);
                                if (ConnectionData.isWelcome(newId)) {
                                    willSaveConnection = true;
                                    break;
                                }
                            }
                        }
                        if (willSaveToStorage) {
                            for (int y = 0; y < 16; y++) {
                                for (int z = 0; z < 16; z++) {
                                    for (int x = 0; x < 16; x++) {
                                        int block = section.getFlatBlock(x, y, z);
                                        if (storage.isWelcome(block)) {
                                            storage.store(new Position((x + (chunk.getX() << 4)), (short) (y + (i << 4)), (z + (chunk.getZ() << 4))), block);
                                        }
                                    }
                                }
                            }
                        }
                        if (willSaveConnection) {
                            for (int y = 0; y < 16; y++) {
                                for (int z = 0; z < 16; z++) {
                                    for (int x = 0; x < 16; x++) {
                                        int block = section.getFlatBlock(x, y, z);
                                        if (ConnectionData.isWelcome(block)) {
                                            ConnectionData.blockConnectionProvider.storeBlock(wrapper.user(), x + (chunk.getX() << 4), y + (i << 4), z + (chunk.getZ() << 4), block);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    // Rewrite biome id 255 to plains
                    if (chunk.isBiomeData()) {
                        int latestBiomeWarn = Integer.MIN_VALUE;
                        for (int i = 0; i < 256; i++) {
                            int biome = chunk.getBiomeData()[i];
                            if (!VALID_BIOMES.contains(biome)) {
                                if (// is it generated naturally? *shrug*
                                biome != 255 && latestBiomeWarn != biome) {
                                    if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
                                        Via.getPlatform().getLogger().warning("Received invalid biome id " + biome);
                                    }
                                    latestBiomeWarn = biome;
                                }
                                // Plains
                                chunk.getBiomeData()[i] = 1;
                            }
                        }
                    }
                    // Rewrite BlockEntities to normal blocks
                    BlockEntityProvider provider = Via.getManager().getProviders().get(BlockEntityProvider.class);
                    final Iterator<CompoundTag> iterator = chunk.getBlockEntities().iterator();
                    while (iterator.hasNext()) {
                        CompoundTag tag = iterator.next();
                        int newId = provider.transform(wrapper.user(), null, tag, false);
                        if (newId != -1) {
                            int x = ((NumberTag) tag.get("x")).asInt();
                            int y = ((NumberTag) tag.get("y")).asInt();
                            int z = ((NumberTag) tag.get("z")).asInt();
                            Position position = new Position(x, (short) y, z);
                            // Store the replacement blocks for blockupdates
                            BlockStorage.ReplacementData replacementData = storage.get(position);
                            if (replacementData != null) {
                                replacementData.setReplacement(newId);
                            }
                            chunk.getSections()[y >> 4].setFlatBlock(x & 0xF, y & 0xF, z & 0xF, newId);
                        }
                        final Tag idTag = tag.get("id");
                        if (idTag instanceof StringTag) {
                            // No longer block entities
                            final String id = ((StringTag) idTag).getValue();
                            if (id.equals("minecraft:noteblock") || id.equals("minecraft:flower_pot")) {
                                iterator.remove();
                            }
                        }
                    }
                    if (Via.getConfig().isServersideBlockConnections()) {
                        ConnectionData.connectBlocks(wrapper.user(), chunk);
                        // Workaround for packet order issue
                        wrapper.send(Protocol1_13To1_12_2.class);
                        wrapper.cancel();
                        for (int i = 0; i < chunk.getSections().length; i++) {
                            ChunkSection section = chunk.getSections()[i];
                            if (section == null)
                                continue;
                            ConnectionData.updateChunkSectionNeighbours(wrapper.user(), chunk.getX(), chunk.getZ(), i);
                        }
                    }
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.SPAWN_PARTICLE, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Particle ID
            map(Type.INT);
            // 1 - Long Distance
            map(Type.BOOLEAN);
            // 2 - X
            map(Type.FLOAT);
            // 3 - Y
            map(Type.FLOAT);
            // 4 - Z
            map(Type.FLOAT);
            // 5 - Offset X
            map(Type.FLOAT);
            // 6 - Offset Y
            map(Type.FLOAT);
            // 7 - Offset Z
            map(Type.FLOAT);
            // 8 - Particle Data
            map(Type.FLOAT);
            // 9 - Particle Count
            map(Type.INT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int particleId = wrapper.get(Type.INT, 0);
                    // Get the data (Arrays are overrated)
                    int dataCount = 0;
                    // Particles with 1 data [BlockCrack,BlockDust,FallingDust]
                    if (particleId == 37 || particleId == 38 || particleId == 46)
                        dataCount = 1;
                    else // Particles with 2 data [IconCrack]
                    if (particleId == 36)
                        dataCount = 2;
                    Integer[] data = new Integer[dataCount];
                    for (int i = 0; i < data.length; i++) data[i] = wrapper.read(Type.VAR_INT);
                    Particle particle = ParticleRewriter.rewriteParticle(particleId, data);
                    // Cancel if null or completely removed
                    if (particle == null || particle.getId() == -1) {
                        wrapper.cancel();
                        return;
                    }
                    // Handle reddust particle color
                    if (particle.getId() == 11) {
                        int count = wrapper.get(Type.INT, 1);
                        float speed = wrapper.get(Type.FLOAT, 6);
                        // Only handle for count = 0
                        if (count == 0) {
                            wrapper.set(Type.INT, 1, 1);
                            wrapper.set(Type.FLOAT, 6, 0f);
                            List<Particle.ParticleData> arguments = particle.getArguments();
                            for (int i = 0; i < 3; i++) {
                                // RGB values are represented by the X/Y/Z offset
                                float colorValue = wrapper.get(Type.FLOAT, i + 3) * speed;
                                if (colorValue == 0 && i == 0) {
                                    // https://minecraft.gamepedia.com/User:Alphappy/reddust
                                    colorValue = 1;
                                }
                                arguments.get(i).setValue(colorValue);
                                wrapper.set(Type.FLOAT, i + 3, 0f);
                            }
                        }
                    }
                    wrapper.set(Type.INT, 0, particle.getId());
                    for (Particle.ParticleData particleData : particle.getArguments()) wrapper.write(particleData.getType(), particleData.getValue());
                }
            });
        }
    });
}
Also used : StringTag(com.github.steveice10.opennbt.tag.builtin.StringTag) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Chunk1_9_3_4Type(com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type) Particle(com.viaversion.viaversion.api.type.types.Particle) BlockChangeRecord(com.viaversion.viaversion.api.minecraft.BlockChangeRecord) BlockStorage(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockStorage) Chunk1_13Type(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type) CompoundTag(com.github.steveice10.opennbt.tag.builtin.CompoundTag) Position(com.viaversion.viaversion.api.minecraft.Position) PaintingProvider(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PaintingProvider) Chunk(com.viaversion.viaversion.api.minecraft.chunks.Chunk) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) ConnectionHandler(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionHandler) PacketHandler(com.viaversion.viaversion.api.protocol.remapper.PacketHandler) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) NumberTag(com.github.steveice10.opennbt.tag.builtin.NumberTag) ClientWorld(com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld) CompoundTag(com.github.steveice10.opennbt.tag.builtin.CompoundTag) NumberTag(com.github.steveice10.opennbt.tag.builtin.NumberTag) StringTag(com.github.steveice10.opennbt.tag.builtin.StringTag) Tag(com.github.steveice10.opennbt.tag.builtin.Tag) BlockEntityProvider(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider) ChunkSection(com.viaversion.viaversion.api.minecraft.chunks.ChunkSection)

Example 2 with Protocol1_13To1_12_2

use of com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2 in project ViaVersion by ViaVersion.

the class Protocol1_13To1_12_2 method registerPackets.

@Override
protected void registerPackets() {
    entityRewriter.register();
    itemRewriter.register();
    EntityPackets.register(this);
    WorldPackets.register(this);
    registerClientbound(State.LOGIN, 0x0, 0x0, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> componentRewriter.processText(wrapper.passthrough(Type.COMPONENT)));
        }
    });
    registerClientbound(State.STATUS, 0x00, 0x00, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.STRING);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    String response = wrapper.get(Type.STRING, 0);
                    try {
                        JsonObject json = GsonUtil.getGson().fromJson(response, JsonObject.class);
                        if (json.has("favicon")) {
                            json.addProperty("favicon", json.get("favicon").getAsString().replace("\n", ""));
                        }
                        wrapper.set(Type.STRING, 0, GsonUtil.getGson().toJson(json));
                    } catch (JsonParseException e) {
                        e.printStackTrace();
                    }
                }
            });
        }
    });
    // New packet 0x04 - Login Plugin Message
    // Statistics
    registerClientbound(ClientboundPackets1_12_1.STATISTICS, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int size = wrapper.read(Type.VAR_INT);
                    List<StatisticData> remappedStats = new ArrayList<>();
                    for (int i = 0; i < size; i++) {
                        String name = wrapper.read(Type.STRING);
                        String[] split = name.split("\\.");
                        int categoryId = 0;
                        int newId = -1;
                        int value = wrapper.read(Type.VAR_INT);
                        if (split.length == 2) {
                            // Custom types
                            categoryId = 8;
                            Integer newIdRaw = StatisticMappings.CUSTOM_STATS.get(name);
                            if (newIdRaw != null) {
                                newId = newIdRaw;
                            } else {
                                Via.getPlatform().getLogger().warning("Could not find 1.13 -> 1.12.2 statistic mapping for " + name);
                            }
                        } else if (split.length > 2) {
                            String category = split[1];
                            // TODO convert string ids (blocks, items, entities)
                            switch(category) {
                                case "mineBlock":
                                    categoryId = 0;
                                    break;
                                case "craftItem":
                                    categoryId = 1;
                                    break;
                                case "useItem":
                                    categoryId = 2;
                                    break;
                                case "breakItem":
                                    categoryId = 3;
                                    break;
                                case "pickup":
                                    categoryId = 4;
                                    break;
                                case "drop":
                                    categoryId = 5;
                                    break;
                                case "killEntity":
                                    categoryId = 6;
                                    break;
                                case "entityKilledBy":
                                    categoryId = 7;
                                    break;
                            }
                        }
                        if (newId != -1)
                            remappedStats.add(new StatisticData(categoryId, newId, value));
                    }
                    // size
                    wrapper.write(Type.VAR_INT, remappedStats.size());
                    for (StatisticData stat : remappedStats) {
                        // category id
                        wrapper.write(Type.VAR_INT, stat.getCategoryId());
                        // statistics id
                        wrapper.write(Type.VAR_INT, stat.getNewId());
                        // value
                        wrapper.write(Type.VAR_INT, stat.getValue());
                    }
                }
            });
        }
    });
    componentRewriter.registerBossBar(ClientboundPackets1_12_1.BOSSBAR);
    componentRewriter.registerComponentPacket(ClientboundPackets1_12_1.CHAT_MESSAGE);
    registerClientbound(ClientboundPackets1_12_1.TAB_COMPLETE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    wrapper.write(Type.VAR_INT, wrapper.user().get(TabCompleteTracker.class).getTransactionId());
                    String input = wrapper.user().get(TabCompleteTracker.class).getInput();
                    // Start & End
                    int index;
                    int length;
                    // If no input or new word (then it's the start)
                    if (input.endsWith(" ") || input.isEmpty()) {
                        index = input.length();
                        length = 0;
                    } else {
                        // Otherwise find the last space (+1 as we include it)
                        int lastSpace = input.lastIndexOf(' ') + 1;
                        index = lastSpace;
                        length = input.length() - lastSpace;
                    }
                    // Write index + length
                    wrapper.write(Type.VAR_INT, index);
                    wrapper.write(Type.VAR_INT, length);
                    int count = wrapper.passthrough(Type.VAR_INT);
                    for (int i = 0; i < count; i++) {
                        String suggestion = wrapper.read(Type.STRING);
                        // If we're at the start then handle removing slash
                        if (suggestion.startsWith("/") && index == 0) {
                            suggestion = suggestion.substring(1);
                        }
                        wrapper.write(Type.STRING, suggestion);
                        wrapper.write(Type.BOOLEAN, false);
                    }
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_12_1.OPEN_WINDOW, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Id
            map(Type.UNSIGNED_BYTE);
            // Window type
            map(Type.STRING);
            // Title
            handler(wrapper -> componentRewriter.processText(wrapper.passthrough(Type.COMPONENT)));
        }
    });
    registerClientbound(ClientboundPackets1_12_1.COOLDOWN, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int item = wrapper.read(Type.VAR_INT);
                    int ticks = wrapper.read(Type.VAR_INT);
                    wrapper.cancel();
                    if (item == 383) {
                        // Spawn egg
                        for (int i = 0; i < 44; i++) {
                            Integer newItem = getMappingData().getItemMappings().get(item << 16 | i);
                            if (newItem != null) {
                                PacketWrapper packet = wrapper.create(ClientboundPackets1_13.COOLDOWN);
                                packet.write(Type.VAR_INT, newItem);
                                packet.write(Type.VAR_INT, ticks);
                                packet.send(Protocol1_13To1_12_2.class);
                            } else {
                                break;
                            }
                        }
                    } else {
                        for (int i = 0; i < 16; i++) {
                            int newItem = getMappingData().getItemMappings().get(item << 4 | i);
                            if (newItem != -1) {
                                PacketWrapper packet = wrapper.create(ClientboundPackets1_13.COOLDOWN);
                                packet.write(Type.VAR_INT, newItem);
                                packet.write(Type.VAR_INT, ticks);
                                packet.send(Protocol1_13To1_12_2.class);
                            } else {
                                break;
                            }
                        }
                    }
                }
            });
        }
    });
    componentRewriter.registerComponentPacket(ClientboundPackets1_12_1.DISCONNECT);
    registerClientbound(ClientboundPackets1_12_1.EFFECT, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Effect Id
            map(Type.INT);
            // Location
            map(Type.POSITION);
            // Data
            map(Type.INT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int id = wrapper.get(Type.INT, 0);
                    int data = wrapper.get(Type.INT, 1);
                    if (id == 1010) {
                        // Play record
                        wrapper.set(Type.INT, 1, getMappingData().getItemMappings().get(data << 4));
                    } else if (id == 2001) {
                        // Block break + block break sound
                        int blockId = data & 0xFFF;
                        int blockData = data >> 12;
                        wrapper.set(Type.INT, 1, WorldPackets.toNewId(blockId << 4 | blockData));
                    }
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_12_1.JOIN_GAME, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Entity ID
            map(Type.INT);
            // 1 - Gamemode
            map(Type.UNSIGNED_BYTE);
            // 2 - Dimension
            map(Type.INT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    // Store the player
                    int entityId = wrapper.get(Type.INT, 0);
                    wrapper.user().getEntityTracker(Protocol1_13To1_12_2.class).addEntity(entityId, Entity1_13Types.EntityType.PLAYER);
                    ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
                    int dimensionId = wrapper.get(Type.INT, 1);
                    clientChunks.setEnvironment(dimensionId);
                }
            });
            handler(SEND_DECLARE_COMMANDS_AND_TAGS);
        }
    });
    registerClientbound(ClientboundPackets1_12_1.CRAFT_RECIPE_RESPONSE, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.BYTE);
            handler(wrapper -> wrapper.write(Type.STRING, "viaversion:legacy/" + wrapper.read(Type.VAR_INT)));
        }
    });
    componentRewriter.registerCombatEvent(ClientboundPackets1_12_1.COMBAT_EVENT);
    registerClientbound(ClientboundPackets1_12_1.MAP_DATA, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Map id
            map(Type.VAR_INT);
            // 1 - Scale
            map(Type.BYTE);
            // 2 - Tracking Position
            map(Type.BOOLEAN);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int iconCount = wrapper.passthrough(Type.VAR_INT);
                    for (int i = 0; i < iconCount; i++) {
                        byte directionAndType = wrapper.read(Type.BYTE);
                        int type = (directionAndType & 0xF0) >> 4;
                        wrapper.write(Type.VAR_INT, type);
                        // Icon X
                        wrapper.passthrough(Type.BYTE);
                        // Icon Z
                        wrapper.passthrough(Type.BYTE);
                        byte direction = (byte) (directionAndType & 0x0F);
                        wrapper.write(Type.BYTE, direction);
                        // Display Name
                        wrapper.write(Type.OPTIONAL_COMPONENT, null);
                    }
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_12_1.UNLOCK_RECIPES, new PacketRemapper() {

        @Override
        public void registerMap() {
            // action
            map(Type.VAR_INT);
            // crafting book open
            map(Type.BOOLEAN);
            // crafting filter active
            map(Type.BOOLEAN);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    // smelting book open
                    wrapper.write(Type.BOOLEAN, false);
                    // smelting filter active
                    wrapper.write(Type.BOOLEAN, false);
                }
            });
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int action = wrapper.get(Type.VAR_INT, 0);
                    for (int i = 0; i < (action == 0 ? 2 : 1); i++) {
                        int[] ids = wrapper.read(Type.VAR_INT_ARRAY_PRIMITIVE);
                        String[] stringIds = new String[ids.length];
                        for (int j = 0; j < ids.length; j++) {
                            stringIds[j] = "viaversion:legacy/" + ids[j];
                        }
                        wrapper.write(Type.STRING_ARRAY, stringIds);
                    }
                    if (action == 0) {
                        wrapper.create(ClientboundPackets1_13.DECLARE_RECIPES, new // Declare recipes
                        PacketHandler() {

                            @Override
                            public void handle(PacketWrapper wrapper) throws Exception {
                                wrapper.write(Type.VAR_INT, RecipeData.recipes.size());
                                for (Map.Entry<String, RecipeData.Recipe> entry : RecipeData.recipes.entrySet()) {
                                    // Id
                                    wrapper.write(Type.STRING, entry.getKey());
                                    wrapper.write(Type.STRING, entry.getValue().getType());
                                    switch(entry.getValue().getType()) {
                                        case "crafting_shapeless":
                                            {
                                                wrapper.write(Type.STRING, entry.getValue().getGroup());
                                                wrapper.write(Type.VAR_INT, entry.getValue().getIngredients().length);
                                                for (Item[] ingredient : entry.getValue().getIngredients()) {
                                                    // Clone because array and item is mutable
                                                    Item[] clone = ingredient.clone();
                                                    for (int i = 0; i < clone.length; i++) {
                                                        if (clone[i] == null)
                                                            continue;
                                                        clone[i] = new DataItem(clone[i]);
                                                    }
                                                    wrapper.write(Type.FLAT_ITEM_ARRAY_VAR_INT, clone);
                                                }
                                                wrapper.write(Type.FLAT_ITEM, new DataItem(entry.getValue().getResult()));
                                                break;
                                            }
                                        case "crafting_shaped":
                                            {
                                                wrapper.write(Type.VAR_INT, entry.getValue().getWidth());
                                                wrapper.write(Type.VAR_INT, entry.getValue().getHeight());
                                                wrapper.write(Type.STRING, entry.getValue().getGroup());
                                                for (Item[] ingredient : entry.getValue().getIngredients()) {
                                                    // Clone because array and item is mutable
                                                    Item[] clone = ingredient.clone();
                                                    for (int i = 0; i < clone.length; i++) {
                                                        if (clone[i] == null)
                                                            continue;
                                                        clone[i] = new DataItem(clone[i]);
                                                    }
                                                    wrapper.write(Type.FLAT_ITEM_ARRAY_VAR_INT, clone);
                                                }
                                                wrapper.write(Type.FLAT_ITEM, new DataItem(entry.getValue().getResult()));
                                                break;
                                            }
                                        case "smelting":
                                            {
                                                wrapper.write(Type.STRING, entry.getValue().getGroup());
                                                // Clone because array and item is mutable
                                                Item[] clone = entry.getValue().getIngredient().clone();
                                                for (int i = 0; i < clone.length; i++) {
                                                    if (clone[i] == null)
                                                        continue;
                                                    clone[i] = new DataItem(clone[i]);
                                                }
                                                wrapper.write(Type.FLAT_ITEM_ARRAY_VAR_INT, clone);
                                                wrapper.write(Type.FLAT_ITEM, new DataItem(entry.getValue().getResult()));
                                                wrapper.write(Type.FLOAT, entry.getValue().getExperience());
                                                wrapper.write(Type.VAR_INT, entry.getValue().getCookingTime());
                                                break;
                                            }
                                    }
                                }
                            }
                        }).send(Protocol1_13To1_12_2.class);
                    }
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_12_1.RESPAWN, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Dimension ID
            map(Type.INT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
                    int dimensionId = wrapper.get(Type.INT, 0);
                    clientWorld.setEnvironment(dimensionId);
                    if (Via.getConfig().isServersideBlockConnections()) {
                        ConnectionData.clearBlockStorage(wrapper.user());
                    }
                }
            });
            handler(SEND_DECLARE_COMMANDS_AND_TAGS);
        }
    });
    registerClientbound(ClientboundPackets1_12_1.SCOREBOARD_OBJECTIVE, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Objective name
            map(Type.STRING);
            // 1 - Mode
            map(Type.BYTE);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    byte mode = wrapper.get(Type.BYTE, 0);
                    // On create or update
                    if (mode == 0 || mode == 2) {
                        // Value
                        String value = wrapper.read(Type.STRING);
                        wrapper.write(Type.COMPONENT, ChatRewriter.legacyTextToJson(value));
                        String type = wrapper.read(Type.STRING);
                        // integer or hearts
                        wrapper.write(Type.VAR_INT, type.equals("integer") ? 0 : 1);
                    }
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_12_1.TEAMS, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Team Name
            map(Type.STRING);
            // 1 - Mode
            map(Type.BYTE);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    byte action = wrapper.get(Type.BYTE, 0);
                    if (action == 0 || action == 2) {
                        // Display Name
                        String displayName = wrapper.read(Type.STRING);
                        wrapper.write(Type.COMPONENT, ChatRewriter.legacyTextToJson(displayName));
                        // Prefix moved
                        String prefix = wrapper.read(Type.STRING);
                        // Suffix moved
                        String suffix = wrapper.read(Type.STRING);
                        // Flags
                        wrapper.passthrough(Type.BYTE);
                        // Name Tag Visibility
                        wrapper.passthrough(Type.STRING);
                        // Collision rule
                        wrapper.passthrough(Type.STRING);
                        // Handle new colors
                        int colour = wrapper.read(Type.BYTE).intValue();
                        if (colour == -1) {
                            // -1 changed to 21
                            colour = 21;
                        }
                        if (Via.getConfig().is1_13TeamColourFix()) {
                            char lastColorChar = getLastColorChar(prefix);
                            colour = ChatColorUtil.getColorOrdinal(lastColorChar);
                            suffix = ChatColorUtil.COLOR_CHAR + Character.toString(lastColorChar) + suffix;
                        }
                        wrapper.write(Type.VAR_INT, colour);
                        // Prefix
                        wrapper.write(Type.COMPONENT, ChatRewriter.legacyTextToJson(prefix));
                        // Suffix
                        wrapper.write(Type.COMPONENT, ChatRewriter.legacyTextToJson(suffix));
                    }
                    if (action == 0 || action == 3 || action == 4) {
                        // Entities
                        String[] names = wrapper.read(Type.STRING_ARRAY);
                        for (int i = 0; i < names.length; i++) {
                            names[i] = rewriteTeamMemberName(names[i]);
                        }
                        wrapper.write(Type.STRING_ARRAY, names);
                    }
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_12_1.UPDATE_SCORE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    // Display Name
                    String displayName = wrapper.read(Type.STRING);
                    displayName = rewriteTeamMemberName(displayName);
                    wrapper.write(Type.STRING, displayName);
                    byte action = wrapper.read(Type.BYTE);
                    wrapper.write(Type.BYTE, action);
                    // Objective Name
                    wrapper.passthrough(Type.STRING);
                    if (action != 1) {
                        // Value
                        wrapper.passthrough(Type.VAR_INT);
                    }
                }
            });
        }
    });
    componentRewriter.registerTitle(ClientboundPackets1_12_1.TITLE);
    // New 0x4C - Stop Sound
    new SoundRewriter(this).registerSound(ClientboundPackets1_12_1.SOUND);
    registerClientbound(ClientboundPackets1_12_1.TAB_LIST, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    componentRewriter.processText(wrapper.passthrough(Type.COMPONENT));
                    componentRewriter.processText(wrapper.passthrough(Type.COMPONENT));
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_12_1.ADVANCEMENTS, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    // Reset/clear
                    wrapper.passthrough(Type.BOOLEAN);
                    // Mapping size
                    int size = wrapper.passthrough(Type.VAR_INT);
                    for (int i = 0; i < size; i++) {
                        // Identifier
                        wrapper.passthrough(Type.STRING);
                        // Parent
                        if (wrapper.passthrough(Type.BOOLEAN))
                            wrapper.passthrough(Type.STRING);
                        // Display data
                        if (wrapper.passthrough(Type.BOOLEAN)) {
                            // Title
                            componentRewriter.processText(wrapper.passthrough(Type.COMPONENT));
                            // Description
                            componentRewriter.processText(wrapper.passthrough(Type.COMPONENT));
                            Item icon = wrapper.read(Type.ITEM);
                            itemRewriter.handleItemToClient(icon);
                            // Translate item to flat item
                            wrapper.write(Type.FLAT_ITEM, icon);
                            // Frame type
                            wrapper.passthrough(Type.VAR_INT);
                            // Flags
                            int flags = wrapper.passthrough(Type.INT);
                            if ((flags & 1) != 0) {
                                // Background texture
                                wrapper.passthrough(Type.STRING);
                            }
                            // X
                            wrapper.passthrough(Type.FLOAT);
                            // Y
                            wrapper.passthrough(Type.FLOAT);
                        }
                        // Criteria
                        wrapper.passthrough(Type.STRING_ARRAY);
                        int arrayLength = wrapper.passthrough(Type.VAR_INT);
                        for (int array = 0; array < arrayLength; array++) {
                            // String array
                            wrapper.passthrough(Type.STRING_ARRAY);
                        }
                    }
                }
            });
        }
    });
    // Incoming packets
    // New packet 0x02 - Login Plugin Message
    cancelServerbound(State.LOGIN, 0x02);
    // New 0x01 - Query Block NBT
    cancelServerbound(ServerboundPackets1_13.QUERY_BLOCK_NBT);
    // Tab-Complete
    registerServerbound(ServerboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    // Disable auto-complete if configured
                    if (Via.getConfig().isDisable1_13AutoComplete()) {
                        wrapper.cancel();
                    }
                    int tid = wrapper.read(Type.VAR_INT);
                    // Save transaction id
                    wrapper.user().get(TabCompleteTracker.class).setTransactionId(tid);
                }
            });
            // Prepend /
            map(Type.STRING, new ValueTransformer<String, String>(Type.STRING) {

                @Override
                public String transform(PacketWrapper wrapper, String inputValue) {
                    wrapper.user().get(TabCompleteTracker.class).setInput(inputValue);
                    return "/" + inputValue;
                }
            });
            // Fake the end of the packet
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    wrapper.write(Type.BOOLEAN, false);
                    wrapper.write(Type.OPTIONAL_POSITION, null);
                    if (!wrapper.isCancelled() && Via.getConfig().get1_13TabCompleteDelay() > 0) {
                        TabCompleteTracker tracker = wrapper.user().get(TabCompleteTracker.class);
                        wrapper.cancel();
                        tracker.setTimeToSend(System.currentTimeMillis() + Via.getConfig().get1_13TabCompleteDelay() * 50L);
                        tracker.setLastTabComplete(wrapper.get(Type.STRING, 0));
                    }
                }
            });
        }
    });
    // New 0x0A - Edit book -> Plugin Message
    registerServerbound(ServerboundPackets1_13.EDIT_BOOK, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    Item item = wrapper.read(Type.FLAT_ITEM);
                    boolean isSigning = wrapper.read(Type.BOOLEAN);
                    itemRewriter.handleItemToServer(item);
                    // Channel
                    wrapper.write(Type.STRING, isSigning ? "MC|BSign" : "MC|BEdit");
                    wrapper.write(Type.ITEM, item);
                }
            });
        }
    });
    // New 0x0C - Query Entity NBT
    cancelServerbound(ServerboundPackets1_13.ENTITY_NBT_REQUEST);
    // New 0x15 - Pick Item -> Plugin Message
    registerServerbound(ServerboundPackets1_13.PICK_ITEM, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    // Channel
                    wrapper.write(Type.STRING, "MC|PickItem");
                }
            });
        }
    });
    registerServerbound(ServerboundPackets1_13.CRAFT_RECIPE_REQUEST, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Window id
            map(Type.BYTE);
            handler(wrapper -> {
                String s = wrapper.read(Type.STRING);
                Integer id;
                if (s.length() < 19 || (id = Ints.tryParse(s.substring(18))) == null) {
                    wrapper.cancel();
                    return;
                }
                wrapper.write(Type.VAR_INT, id);
            });
        }
    });
    registerServerbound(ServerboundPackets1_13.RECIPE_BOOK_DATA, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Type
            map(Type.VAR_INT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int type = wrapper.get(Type.VAR_INT, 0);
                    if (type == 0) {
                        String s = wrapper.read(Type.STRING);
                        Integer id;
                        // Custom recipes
                        if (s.length() < 19 || (id = Ints.tryParse(s.substring(18))) == null) {
                            wrapper.cancel();
                            return;
                        }
                        wrapper.write(Type.INT, id);
                    }
                    if (type == 1) {
                        // Crafting Recipe Book Open
                        wrapper.passthrough(Type.BOOLEAN);
                        // Crafting Recipe Filter Active
                        wrapper.passthrough(Type.BOOLEAN);
                        // Smelting Recipe Book Open | IGNORE NEW 1.13 FIELD
                        wrapper.read(Type.BOOLEAN);
                        // Smelting Recipe Filter Active | IGNORE NEW 1.13 FIELD
                        wrapper.read(Type.BOOLEAN);
                    }
                }
            });
        }
    });
    // New 0x1C - Name Item -> Plugin Message
    registerServerbound(ServerboundPackets1_13.RENAME_ITEM, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                // Channel
                wrapper.write(Type.STRING, "MC|ItemName");
            });
        }
    });
    // New 0x1F - Select Trade -> Plugin Message
    registerServerbound(ServerboundPackets1_13.SELECT_TRADE, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                // Channel
                wrapper.write(Type.STRING, "MC|TrSel");
            });
            // Slot
            map(Type.VAR_INT, Type.INT);
        }
    });
    // New 0x20 - Set Beacon Effect -> Plugin Message
    registerServerbound(ServerboundPackets1_13.SET_BEACON_EFFECT, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                // Channel
                wrapper.write(Type.STRING, "MC|Beacon");
            });
            // Primary Effect
            map(Type.VAR_INT, Type.INT);
            // Secondary Effect
            map(Type.VAR_INT, Type.INT);
        }
    });
    // New 0x22 - Update Command Block -> Plugin Message
    registerServerbound(ServerboundPackets1_13.UPDATE_COMMAND_BLOCK, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> wrapper.write(Type.STRING, "MC|AutoCmd"));
            handler(POS_TO_3_INT);
            // Command
            map(Type.STRING);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int mode = wrapper.read(Type.VAR_INT);
                    byte flags = wrapper.read(Type.BYTE);
                    String stringMode = mode == 0 ? "SEQUENCE" : mode == 1 ? "AUTO" : "REDSTONE";
                    // Track output
                    wrapper.write(Type.BOOLEAN, (flags & 0x1) != 0);
                    wrapper.write(Type.STRING, stringMode);
                    // Is conditional
                    wrapper.write(Type.BOOLEAN, (flags & 0x2) != 0);
                    // Automatic
                    wrapper.write(Type.BOOLEAN, (flags & 0x4) != 0);
                }
            });
        }
    });
    // New 0x23 - Update Command Block Minecart -> Plugin Message
    registerServerbound(ServerboundPackets1_13.UPDATE_COMMAND_BLOCK_MINECART, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    wrapper.write(Type.STRING, "MC|AdvCmd");
                    // Type 1 for Entity
                    wrapper.write(Type.BYTE, (byte) 1);
                }
            });
            // Entity Id
            map(Type.VAR_INT, Type.INT);
        }
    });
    // 0x1B -> 0x24 in InventoryPackets
    // New 0x25 - Update Structure Block -> Message Channel
    registerServerbound(ServerboundPackets1_13.UPDATE_STRUCTURE_BLOCK, ServerboundPackets1_12_1.PLUGIN_MESSAGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                // Channel
                wrapper.write(Type.STRING, "MC|Struct");
            });
            handler(POS_TO_3_INT);
            map(Type.VAR_INT, new // Action
            ValueTransformer<Integer, Byte>(// Action
            Type.BYTE) {

                @Override
                public Byte transform(PacketWrapper wrapper, Integer action) throws Exception {
                    return (byte) (action + 1);
                }
            });
            // Action
            map(Type.VAR_INT, new ValueTransformer<Integer, String>(Type.STRING) {

                @Override
                public String transform(PacketWrapper wrapper, Integer mode) throws Exception {
                    return mode == 0 ? "SAVE" : mode == 1 ? "LOAD" : mode == 2 ? "CORNER" : "DATA";
                }
            });
            // Name
            map(Type.STRING);
            // Offset X
            map(Type.BYTE, Type.INT);
            // Offset Y
            map(Type.BYTE, Type.INT);
            // Offset Z
            map(Type.BYTE, Type.INT);
            // Size X
            map(Type.BYTE, Type.INT);
            // Size Y
            map(Type.BYTE, Type.INT);
            // Size Z
            map(Type.BYTE, Type.INT);
            map(Type.VAR_INT, new // Mirror
            ValueTransformer<Integer, String>(// Mirror
            Type.STRING) {

                @Override
                public String transform(PacketWrapper wrapper, Integer mirror) throws Exception {
                    return mirror == 0 ? "NONE" : mirror == 1 ? "LEFT_RIGHT" : "FRONT_BACK";
                }
            });
            map(Type.VAR_INT, new // Rotation
            ValueTransformer<Integer, String>(// Rotation
            Type.STRING) {

                @Override
                public String transform(PacketWrapper wrapper, Integer rotation) throws Exception {
                    return rotation == 0 ? "NONE" : rotation == 1 ? "CLOCKWISE_90" : rotation == 2 ? "CLOCKWISE_180" : "COUNTERCLOCKWISE_90";
                }
            });
            map(Type.STRING);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    float integrity = wrapper.read(Type.FLOAT);
                    long seed = wrapper.read(Type.VAR_LONG);
                    byte flags = wrapper.read(Type.BYTE);
                    // Ignore Entities
                    wrapper.write(Type.BOOLEAN, (flags & 0x1) != 0);
                    // Show air
                    wrapper.write(Type.BOOLEAN, (flags & 0x2) != 0);
                    // Show bounding box
                    wrapper.write(Type.BOOLEAN, (flags & 0x4) != 0);
                    wrapper.write(Type.FLOAT, integrity);
                    wrapper.write(Type.VAR_LONG, seed);
                }
            });
        }
    });
}
Also used : PacketHandler(com.viaversion.viaversion.api.protocol.remapper.PacketHandler) ComponentRewriter(com.viaversion.viaversion.rewriter.ComponentRewriter) JsonObject(com.google.gson.JsonObject) RecipeData(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.RecipeData) BlockConnectionStorage(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockConnectionStorage) Entity1_13Types(com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types) Types1_13(com.viaversion.viaversion.api.type.types.version.Types1_13) MappingData(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.MappingData) BlockStorage(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockStorage) Item(com.viaversion.viaversion.api.minecraft.item.Item) GsonUtil(com.viaversion.viaversion.util.GsonUtil) StatisticMappings(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.StatisticMappings) StatisticData(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.StatisticData) Map(java.util.Map) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) ValueTransformer(com.viaversion.viaversion.api.protocol.remapper.ValueTransformer) BlockConnectionProvider(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.providers.BlockConnectionProvider) ChatColorUtil(com.viaversion.viaversion.util.ChatColorUtil) ServerboundPackets1_12_1(com.viaversion.viaversion.protocols.protocol1_12_1to1_12.ServerboundPackets1_12_1) ViaProviders(com.viaversion.viaversion.api.platform.providers.ViaProviders) ConnectionData(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionData) State(com.viaversion.viaversion.api.protocol.packet.State) EntityPackets(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.packets.EntityPackets) Set(java.util.Set) AbstractProtocol(com.viaversion.viaversion.api.protocol.AbstractProtocol) Sets(com.google.common.collect.Sets) List(java.util.List) MetadataRewriter1_13To1_12_2(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.metadata.MetadataRewriter1_13To1_12_2) InventoryPackets(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.packets.InventoryPackets) PaintingProvider(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PaintingProvider) JsonParseException(com.google.gson.JsonParseException) SoundRewriter(com.viaversion.viaversion.rewriter.SoundRewriter) ParticleType(com.viaversion.viaversion.api.type.types.minecraft.ParticleType) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) ComponentRewriter1_13(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.ComponentRewriter1_13) HashMap(java.util.HashMap) ClientboundPackets1_12_1(com.viaversion.viaversion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1) PacketBlockConnectionProvider(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.blockconnections.providers.PacketBlockConnectionProvider) ArrayList(java.util.ArrayList) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Type(com.viaversion.viaversion.api.type.Type) DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem) EntityTrackerBase(com.viaversion.viaversion.data.entity.EntityTrackerBase) ItemRewriter(com.viaversion.viaversion.api.rewriter.ItemRewriter) BlockIdData(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.BlockIdData) Position(com.viaversion.viaversion.api.minecraft.Position) ClientWorld(com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld) Via(com.viaversion.viaversion.api.Via) Ints(com.google.common.primitives.Ints) EntityRewriter(com.viaversion.viaversion.api.rewriter.EntityRewriter) WorldPackets(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.packets.WorldPackets) BlockEntityProvider(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider) TabCompleteTracker(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.TabCompleteTracker) DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject) JsonParseException(com.google.gson.JsonParseException) StatisticData(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.StatisticData) Item(com.viaversion.viaversion.api.minecraft.item.Item) DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem) TabCompleteTracker(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.TabCompleteTracker) ValueTransformer(com.viaversion.viaversion.api.protocol.remapper.ValueTransformer) PacketHandler(com.viaversion.viaversion.api.protocol.remapper.PacketHandler) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) SoundRewriter(com.viaversion.viaversion.rewriter.SoundRewriter) ClientWorld(com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with Protocol1_13To1_12_2

use of com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2 in project ViaVersion by ViaVersion.

the class EntityPackets method register.

public static void register(Protocol1_13To1_12_2 protocol) {
    MetadataRewriter1_13To1_12_2 metadataRewriter = protocol.get(MetadataRewriter1_13To1_12_2.class);
    protocol.registerClientbound(ClientboundPackets1_12_1.SPAWN_ENTITY, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Entity id
            map(Type.VAR_INT);
            // 1 - UUID
            map(Type.UUID);
            // 2 - Type
            map(Type.BYTE);
            // 3 - X
            map(Type.DOUBLE);
            // 4 - Y
            map(Type.DOUBLE);
            // 5 - Z
            map(Type.DOUBLE);
            // 6 - Pitch
            map(Type.BYTE);
            // 7 - Yaw
            map(Type.BYTE);
            // 8 - Data
            map(Type.INT);
            // Track Entity
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int entityId = wrapper.get(Type.VAR_INT, 0);
                    byte type = wrapper.get(Type.BYTE, 0);
                    Entity1_13Types.EntityType entType = Entity1_13Types.getTypeFromId(type, true);
                    if (entType == null)
                        return;
                    // Register Type ID
                    wrapper.user().getEntityTracker(Protocol1_13To1_12_2.class).addEntity(entityId, entType);
                    if (entType.is(Entity1_13Types.EntityType.FALLING_BLOCK)) {
                        int oldId = wrapper.get(Type.INT, 0);
                        int combined = (((oldId & 4095) << 4) | (oldId >> 12 & 15));
                        wrapper.set(Type.INT, 0, WorldPackets.toNewId(combined));
                    }
                    // Fix ItemFrame hitbox
                    if (entType.is(Entity1_13Types.EntityType.ITEM_FRAME)) {
                        int data = wrapper.get(Type.INT, 0);
                        switch(data) {
                            // South
                            case 0:
                                data = 3;
                                break;
                            // West
                            case 1:
                                data = 4;
                                break;
                            // East
                            case 3:
                                data = 5;
                                break;
                        }
                        wrapper.set(Type.INT, 0, data);
                    }
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.SPAWN_MOB, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Entity ID
            map(Type.VAR_INT);
            // 1 - Entity UUID
            map(Type.UUID);
            // 2 - Entity Type
            map(Type.VAR_INT);
            // 3 - X
            map(Type.DOUBLE);
            // 4 - Y
            map(Type.DOUBLE);
            // 5 - Z
            map(Type.DOUBLE);
            // 6 - Yaw
            map(Type.BYTE);
            // 7 - Pitch
            map(Type.BYTE);
            // 8 - Head Pitch
            map(Type.BYTE);
            // 9 - Velocity X
            map(Type.SHORT);
            // 10 - Velocity Y
            map(Type.SHORT);
            // 11 - Velocity Z
            map(Type.SHORT);
            // 12 - Metadata
            map(Types1_12.METADATA_LIST, Types1_13.METADATA_LIST);
            handler(metadataRewriter.trackerAndRewriterHandler(Types1_13.METADATA_LIST));
        }
    });
    protocol.registerClientbound(ClientboundPackets1_12_1.SPAWN_PLAYER, new PacketRemapper() {

        @Override
        public void registerMap() {
            // 0 - Entity ID
            map(Type.VAR_INT);
            // 1 - Player UUID
            map(Type.UUID);
            // 2 - X
            map(Type.DOUBLE);
            // 3 - Y
            map(Type.DOUBLE);
            // 4 - Z
            map(Type.DOUBLE);
            // 5 - Yaw
            map(Type.BYTE);
            // 6 - Pitch
            map(Type.BYTE);
            // 7 - Metadata
            map(Types1_12.METADATA_LIST, Types1_13.METADATA_LIST);
            handler(metadataRewriter.trackerAndRewriterHandler(Types1_13.METADATA_LIST, Entity1_13Types.EntityType.PLAYER));
        }
    });
    metadataRewriter.registerRemoveEntities(ClientboundPackets1_12_1.DESTROY_ENTITIES);
    metadataRewriter.registerMetadataRewriter(ClientboundPackets1_12_1.ENTITY_METADATA, Types1_12.METADATA_LIST, Types1_13.METADATA_LIST);
}
Also used : PacketHandler(com.viaversion.viaversion.api.protocol.remapper.PacketHandler) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Protocol1_13To1_12_2(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2) MetadataRewriter1_13To1_12_2(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.metadata.MetadataRewriter1_13To1_12_2) Entity1_13Types(com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types)

Example 4 with Protocol1_13To1_12_2

use of com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2 in project ViaVersion by ViaVersion.

the class ProtocolManagerImpl method registerProtocols.

public void registerProtocols() {
    // Base Protocol
    registerBaseProtocol(BASE_PROTOCOL, Range.lessThan(Integer.MIN_VALUE));
    registerBaseProtocol(new BaseProtocol1_7(), Range.lessThan(ProtocolVersion.v1_16.getVersion()));
    registerBaseProtocol(new BaseProtocol1_16(), Range.atLeast(ProtocolVersion.v1_16.getVersion()));
    registerProtocol(new Protocol1_9To1_8(), ProtocolVersion.v1_9, ProtocolVersion.v1_8);
    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);
    registerProtocol(new Protocol1_11_1To1_11(), ProtocolVersion.v1_11_1, ProtocolVersion.v1_11);
    registerProtocol(new Protocol1_12To1_11_1(), ProtocolVersion.v1_12, ProtocolVersion.v1_11_1);
    registerProtocol(new Protocol1_12_1To1_12(), ProtocolVersion.v1_12_1, ProtocolVersion.v1_12);
    registerProtocol(new Protocol1_12_2To1_12_1(), ProtocolVersion.v1_12_2, ProtocolVersion.v1_12_1);
    registerProtocol(new Protocol1_13To1_12_2(), ProtocolVersion.v1_13, ProtocolVersion.v1_12_2);
    registerProtocol(new Protocol1_13_1To1_13(), ProtocolVersion.v1_13_1, ProtocolVersion.v1_13);
    registerProtocol(new Protocol1_13_2To1_13_1(), ProtocolVersion.v1_13_2, ProtocolVersion.v1_13_1);
    registerProtocol(new Protocol1_14To1_13_2(), ProtocolVersion.v1_14, ProtocolVersion.v1_13_2);
    registerProtocol(new Protocol1_14_1To1_14(), ProtocolVersion.v1_14_1, ProtocolVersion.v1_14);
    registerProtocol(new Protocol1_14_2To1_14_1(), ProtocolVersion.v1_14_2, ProtocolVersion.v1_14_1);
    registerProtocol(new Protocol1_14_3To1_14_2(), ProtocolVersion.v1_14_3, ProtocolVersion.v1_14_2);
    registerProtocol(new Protocol1_14_4To1_14_3(), ProtocolVersion.v1_14_4, ProtocolVersion.v1_14_3);
    registerProtocol(new Protocol1_15To1_14_4(), ProtocolVersion.v1_15, ProtocolVersion.v1_14_4);
    registerProtocol(new Protocol1_15_1To1_15(), ProtocolVersion.v1_15_1, ProtocolVersion.v1_15);
    registerProtocol(new Protocol1_15_2To1_15_1(), ProtocolVersion.v1_15_2, ProtocolVersion.v1_15_1);
    registerProtocol(new Protocol1_16To1_15_2(), ProtocolVersion.v1_16, ProtocolVersion.v1_15_2);
    registerProtocol(new Protocol1_16_1To1_16(), ProtocolVersion.v1_16_1, ProtocolVersion.v1_16);
    registerProtocol(new Protocol1_16_2To1_16_1(), ProtocolVersion.v1_16_2, ProtocolVersion.v1_16_1);
    registerProtocol(new Protocol1_16_3To1_16_2(), ProtocolVersion.v1_16_3, ProtocolVersion.v1_16_2);
    registerProtocol(new Protocol1_16_4To1_16_3(), ProtocolVersion.v1_16_4, ProtocolVersion.v1_16_3);
    registerProtocol(new Protocol1_17To1_16_4(), ProtocolVersion.v1_17, ProtocolVersion.v1_16_4);
    registerProtocol(new Protocol1_17_1To1_17(), ProtocolVersion.v1_17_1, ProtocolVersion.v1_17);
    registerProtocol(new Protocol1_18To1_17_1(), ProtocolVersion.v1_18, ProtocolVersion.v1_17_1);
    registerProtocol(new Protocol1_18_2To1_18(), ProtocolVersion.v1_18_2, ProtocolVersion.v1_18);
}
Also used : Protocol1_14_4To1_14_3(com.viaversion.viaversion.protocols.protocol1_14_4to1_14_3.Protocol1_14_4To1_14_3) Protocol1_16_2To1_16_1(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1) Protocol1_16_3To1_16_2(com.viaversion.viaversion.protocols.protocol1_16_3to1_16_2.Protocol1_16_3To1_16_2) Protocol1_12To1_11_1(com.viaversion.viaversion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1) Protocol1_11To1_10(com.viaversion.viaversion.protocols.protocol1_11to1_10.Protocol1_11To1_10) Protocol1_14_3To1_14_2(com.viaversion.viaversion.protocols.protocol1_14_3to1_14_2.Protocol1_14_3To1_14_2) Protocol1_11_1To1_11(com.viaversion.viaversion.protocols.protocol1_11_1to1_11.Protocol1_11_1To1_11) Protocol1_13To1_12_2(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2) Protocol1_16_4To1_16_3(com.viaversion.viaversion.protocols.protocol1_16_4to1_16_3.Protocol1_16_4To1_16_3) Protocol1_14_2To1_14_1(com.viaversion.viaversion.protocols.protocol1_14_2to1_14_1.Protocol1_14_2To1_14_1) Protocol1_12_1To1_12(com.viaversion.viaversion.protocols.protocol1_12_1to1_12.Protocol1_12_1To1_12) Protocol1_14_1To1_14(com.viaversion.viaversion.protocols.protocol1_14_1to1_14.Protocol1_14_1To1_14) Protocol1_15_1To1_15(com.viaversion.viaversion.protocols.protocol1_15_1to1_15.Protocol1_15_1To1_15) Protocol1_16To1_15_2(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2) Protocol1_17To1_16_4(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4) Protocol1_16_1To1_16(com.viaversion.viaversion.protocols.protocol1_16_1to1_16.Protocol1_16_1To1_16) Protocol1_13_1To1_13(com.viaversion.viaversion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13) Protocol1_14To1_13_2(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2) Protocol1_12_2To1_12_1(com.viaversion.viaversion.protocols.protocol1_12_2to1_12_1.Protocol1_12_2To1_12_1) Protocol1_9_1To1_9(com.viaversion.viaversion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9) Protocol1_18_2To1_18(com.viaversion.viaversion.protocols.protocol1_18_2to1_18.Protocol1_18_2To1_18) BaseProtocol1_7(com.viaversion.viaversion.protocols.base.BaseProtocol1_7) Protocol1_15To1_14_4(com.viaversion.viaversion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4) Protocol1_9To1_9_1(com.viaversion.viaversion.protocols.protocol1_9to1_9_1.Protocol1_9To1_9_1) Protocol1_15_2To1_15_1(com.viaversion.viaversion.protocols.protocol1_15_2to1_15_1.Protocol1_15_2To1_15_1) Protocol1_10To1_9_3_4(com.viaversion.viaversion.protocols.protocol1_10to1_9_3.Protocol1_10To1_9_3_4) Protocol1_13_2To1_13_1(com.viaversion.viaversion.protocols.protocol1_13_2to1_13_1.Protocol1_13_2To1_13_1) Protocol1_17_1To1_17(com.viaversion.viaversion.protocols.protocol1_17_1to1_17.Protocol1_17_1To1_17) Protocol1_18To1_17_1(com.viaversion.viaversion.protocols.protocol1_18to1_17_1.Protocol1_18To1_17_1) Protocol1_9_3To1_9_1_2(com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.Protocol1_9_3To1_9_1_2) BaseProtocol1_16(com.viaversion.viaversion.protocols.base.BaseProtocol1_16) Protocol1_9_1_2To1_9_3_4(com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4) Protocol1_9To1_8(com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8)

Aggregations

PacketWrapper (com.viaversion.viaversion.api.protocol.packet.PacketWrapper)3 PacketHandler (com.viaversion.viaversion.api.protocol.remapper.PacketHandler)3 PacketRemapper (com.viaversion.viaversion.api.protocol.remapper.PacketRemapper)3 UserConnection (com.viaversion.viaversion.api.connection.UserConnection)2 Position (com.viaversion.viaversion.api.minecraft.Position)2 Entity1_13Types (com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types)2 Protocol1_13To1_12_2 (com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2)2 BlockEntityProvider (com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider)2 PaintingProvider (com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PaintingProvider)2 BlockStorage (com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockStorage)2 ClientWorld (com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld)2 CompoundTag (com.github.steveice10.opennbt.tag.builtin.CompoundTag)1 NumberTag (com.github.steveice10.opennbt.tag.builtin.NumberTag)1 StringTag (com.github.steveice10.opennbt.tag.builtin.StringTag)1 Tag (com.github.steveice10.opennbt.tag.builtin.Tag)1 Sets (com.google.common.collect.Sets)1 Ints (com.google.common.primitives.Ints)1 JsonObject (com.google.gson.JsonObject)1 JsonParseException (com.google.gson.JsonParseException)1 Via (com.viaversion.viaversion.api.Via)1