Search in sources :

Example 6 with ServerboundPackets1_16_2

use of com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2 in project ViaBackwards by ViaVersion.

the class BlockItemPackets1_17 method registerPackets.

@Override
protected void registerPackets() {
    BlockRewriter blockRewriter = new BlockRewriter(protocol, Type.POSITION1_14);
    new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_17.DECLARE_RECIPES);
    registerSetCooldown(ClientboundPackets1_17.COOLDOWN);
    registerWindowItems(ClientboundPackets1_17.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
    registerSetSlot(ClientboundPackets1_17.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
    registerEntityEquipmentArray(ClientboundPackets1_17.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
    registerTradeList(ClientboundPackets1_17.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
    registerAdvancements(ClientboundPackets1_17.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
    blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_17.ACKNOWLEDGE_PLAYER_DIGGING);
    blockRewriter.registerBlockAction(ClientboundPackets1_17.BLOCK_ACTION);
    blockRewriter.registerEffect(ClientboundPackets1_17.EFFECT, 1010, 2001);
    registerCreativeInvAction(ServerboundPackets1_16_2.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
    protocol.registerServerbound(ServerboundPackets1_16_2.EDIT_BOOK, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
        }
    });
    // TODO This will cause desync issues for players under certain circumstances, but mostly works:tm:
    protocol.registerServerbound(ServerboundPackets1_16_2.CLICK_WINDOW, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Window Id
            map(Type.UNSIGNED_BYTE);
            // Slot
            map(Type.SHORT);
            // Button
            map(Type.BYTE);
            // Action id - removed
            map(Type.SHORT, Type.NOTHING);
            // Mode
            map(Type.VAR_INT);
            handler(wrapper -> {
                // The 1.17 client would check the entire inventory for changes before -> after a click and send the changed slots here
                // Empty array of slot+item
                wrapper.write(Type.VAR_INT, 0);
                // Expected is the carried item after clicking, old clients send the clicked one (*mostly* being the same)
                handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
            });
        }
    });
    protocol.registerServerbound(ServerboundPackets1_16_2.WINDOW_CONFIRMATION, null, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                wrapper.cancel();
                if (!ViaBackwards.getConfig().handlePingsAsInvAcknowledgements()) {
                    return;
                }
                // Handle ping packet replacement
                short inventoryId = wrapper.read(Type.UNSIGNED_BYTE);
                short confirmationId = wrapper.read(Type.SHORT);
                boolean accepted = wrapper.read(Type.BOOLEAN);
                if (inventoryId == 0 && accepted && wrapper.user().get(PingRequests.class).removeId(confirmationId)) {
                    PacketWrapper pongPacket = wrapper.create(ServerboundPackets1_17.PONG);
                    pongPacket.write(Type.INT, (int) confirmationId);
                    pongPacket.sendToServer(Protocol1_16_4To1_17.class);
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_17.SPAWN_PARTICLE, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Particle id
            map(Type.INT);
            // Long distance
            map(Type.BOOLEAN);
            // X
            map(Type.DOUBLE);
            // Y
            map(Type.DOUBLE);
            // Z
            map(Type.DOUBLE);
            // Offset X
            map(Type.FLOAT);
            // Offset Y
            map(Type.FLOAT);
            // Offset Z
            map(Type.FLOAT);
            // Particle data
            map(Type.FLOAT);
            // Particle count
            map(Type.INT);
            handler(wrapper -> {
                int id = wrapper.get(Type.INT, 0);
                if (id == 16) {
                    // R
                    wrapper.passthrough(Type.FLOAT);
                    // G
                    wrapper.passthrough(Type.FLOAT);
                    // B
                    wrapper.passthrough(Type.FLOAT);
                    // Scale
                    wrapper.passthrough(Type.FLOAT);
                    // Dust color transition -> Dust
                    // R
                    wrapper.read(Type.FLOAT);
                    // G
                    wrapper.read(Type.FLOAT);
                    // B
                    wrapper.read(Type.FLOAT);
                } else if (id == 37) {
                    // Vibration signal - no nice mapping possible without tracking entity positions and doing particle tasks
                    wrapper.set(Type.INT, 0, -1);
                    wrapper.cancel();
                }
            });
            handler(getSpawnParticleHandler(Type.FLAT_VAR_INT_ITEM));
        }
    });
    protocol.mergePacket(ClientboundPackets1_17.WORLD_BORDER_SIZE, ClientboundPackets1_16_2.WORLD_BORDER, 0);
    protocol.mergePacket(ClientboundPackets1_17.WORLD_BORDER_LERP_SIZE, ClientboundPackets1_16_2.WORLD_BORDER, 1);
    protocol.mergePacket(ClientboundPackets1_17.WORLD_BORDER_CENTER, ClientboundPackets1_16_2.WORLD_BORDER, 2);
    protocol.mergePacket(ClientboundPackets1_17.WORLD_BORDER_INIT, ClientboundPackets1_16_2.WORLD_BORDER, 3);
    protocol.mergePacket(ClientboundPackets1_17.WORLD_BORDER_WARNING_DELAY, ClientboundPackets1_16_2.WORLD_BORDER, 4);
    protocol.mergePacket(ClientboundPackets1_17.WORLD_BORDER_WARNING_DISTANCE, ClientboundPackets1_16_2.WORLD_BORDER, 5);
    // The Great Shrunkening
    // Chunk sections *will* be lost ¯\_(ツ)_/¯
    protocol.registerClientbound(ClientboundPackets1_17.UPDATE_LIGHT, new PacketRemapper() {

        @Override
        public void registerMap() {
            // X
            map(Type.VAR_INT);
            // Z
            map(Type.VAR_INT);
            // Trust edges
            map(Type.BOOLEAN);
            handler(wrapper -> {
                EntityTracker tracker = wrapper.user().getEntityTracker(Protocol1_16_4To1_17.class);
                int startFromSection = Math.max(0, -(tracker.currentMinY() >> 4));
                long[] skyLightMask = wrapper.read(Type.LONG_ARRAY_PRIMITIVE);
                long[] blockLightMask = wrapper.read(Type.LONG_ARRAY_PRIMITIVE);
                int cutSkyLightMask = cutLightMask(skyLightMask, startFromSection);
                int cutBlockLightMask = cutLightMask(blockLightMask, startFromSection);
                wrapper.write(Type.VAR_INT, cutSkyLightMask);
                wrapper.write(Type.VAR_INT, cutBlockLightMask);
                long[] emptySkyLightMask = wrapper.read(Type.LONG_ARRAY_PRIMITIVE);
                long[] emptyBlockLightMask = wrapper.read(Type.LONG_ARRAY_PRIMITIVE);
                wrapper.write(Type.VAR_INT, cutLightMask(emptySkyLightMask, startFromSection));
                wrapper.write(Type.VAR_INT, cutLightMask(emptyBlockLightMask, startFromSection));
                writeLightArrays(wrapper, BitSet.valueOf(skyLightMask), cutSkyLightMask, startFromSection, tracker.currentWorldSectionHeight());
                writeLightArrays(wrapper, BitSet.valueOf(blockLightMask), cutBlockLightMask, startFromSection, tracker.currentWorldSectionHeight());
            });
        }

        private void writeLightArrays(PacketWrapper wrapper, BitSet bitMask, int cutBitMask, int startFromSection, int sectionHeight) throws Exception {
            // Length - throw it away
            wrapper.read(Type.VAR_INT);
            List<byte[]> light = new ArrayList<>();
            // Remove lower bounds
            for (int i = 0; i < startFromSection; i++) {
                if (bitMask.get(i)) {
                    wrapper.read(Type.BYTE_ARRAY_PRIMITIVE);
                }
            }
            // Add the important 18 sections
            for (int i = 0; i < 18; i++) {
                if (isSet(cutBitMask, i)) {
                    light.add(wrapper.read(Type.BYTE_ARRAY_PRIMITIVE));
                }
            }
            // Remove upper bounds
            for (int i = startFromSection + 18; i < sectionHeight + 2; i++) {
                if (bitMask.get(i)) {
                    wrapper.read(Type.BYTE_ARRAY_PRIMITIVE);
                }
            }
            // Aaand we're done
            for (byte[] bytes : light) {
                wrapper.write(Type.BYTE_ARRAY_PRIMITIVE, bytes);
            }
        }

        private boolean isSet(int mask, int i) {
            return (mask & (1 << i)) != 0;
        }
    });
    protocol.registerClientbound(ClientboundPackets1_17.MULTI_BLOCK_CHANGE, new PacketRemapper() {

        public void registerMap() {
            // Chunk pos
            map(Type.LONG);
            // Suppress light updates
            map(Type.BOOLEAN);
            handler((wrapper) -> {
                // Remove sections below y 0 and above 255
                long chunkPos = wrapper.get(Type.LONG, 0);
                int chunkY = (int) (chunkPos << 44 >> 44);
                if (chunkY < 0 || chunkY > 15) {
                    wrapper.cancel();
                    return;
                }
                BlockChangeRecord[] records = wrapper.passthrough(Type.VAR_LONG_BLOCK_CHANGE_RECORD_ARRAY);
                for (BlockChangeRecord record : records) {
                    record.setBlockId(protocol.getMappingData().getNewBlockStateId(record.getBlockId()));
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_17.BLOCK_CHANGE, new PacketRemapper() {

        public void registerMap() {
            map(Type.POSITION1_14);
            map(Type.VAR_INT);
            handler((wrapper) -> {
                int y = wrapper.get(Type.POSITION1_14, 0).getY();
                if (y < 0 || y > 255) {
                    wrapper.cancel();
                    return;
                }
                wrapper.set(Type.VAR_INT, 0, protocol.getMappingData().getNewBlockStateId(wrapper.get(Type.VAR_INT, 0)));
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_17.CHUNK_DATA, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                EntityTracker tracker = wrapper.user().getEntityTracker(Protocol1_16_4To1_17.class);
                int currentWorldSectionHeight = tracker.currentWorldSectionHeight();
                Chunk chunk = wrapper.read(new Chunk1_17Type(currentWorldSectionHeight));
                wrapper.write(new Chunk1_16_2Type(), chunk);
                // Cut sections
                int startFromSection = Math.max(0, -(tracker.currentMinY() >> 4));
                chunk.setBiomeData(Arrays.copyOfRange(chunk.getBiomeData(), startFromSection * 64, (startFromSection * 64) + 1024));
                chunk.setBitmask(cutMask(chunk.getChunkMask(), startFromSection, false));
                chunk.setChunkMask(null);
                ChunkSection[] sections = Arrays.copyOfRange(chunk.getSections(), startFromSection, startFromSection + 16);
                chunk.setSections(sections);
                CompoundTag heightMaps = chunk.getHeightMap();
                for (Tag heightMapTag : heightMaps.values()) {
                    LongArrayTag heightMap = (LongArrayTag) heightMapTag;
                    int[] heightMapData = new int[256];
                    int bitsPerEntry = MathUtil.ceilLog2((currentWorldSectionHeight << 4) + 1);
                    // Shift back to 0 based and clamp to normal height with 9 bits
                    CompactArrayUtil.iterateCompactArrayWithPadding(bitsPerEntry, heightMapData.length, heightMap.getValue(), (i, v) -> heightMapData[i] = MathUtil.clamp(v + tracker.currentMinY(), 0, 255));
                    heightMap.setValue(CompactArrayUtil.createCompactArrayWithPadding(9, heightMapData.length, i -> heightMapData[i]));
                }
                for (int i = 0; i < 16; i++) {
                    ChunkSection section = sections[i];
                    if (section == null)
                        continue;
                    for (int j = 0; j < section.getPaletteSize(); j++) {
                        int old = section.getPaletteEntry(j);
                        section.setPaletteEntry(j, protocol.getMappingData().getNewBlockStateId(old));
                    }
                }
                chunk.getBlockEntities().removeIf(compound -> {
                    NumberTag tag = compound.get("y");
                    return tag != null && tag.asInt() < 0;
                });
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_17.BLOCK_ENTITY_DATA, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                int y = wrapper.passthrough(Type.POSITION1_14).getY();
                if (y < 0 || y > 255) {
                    wrapper.cancel();
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_17.BLOCK_BREAK_ANIMATION, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.VAR_INT);
            handler(wrapper -> {
                int y = wrapper.passthrough(Type.POSITION1_14).getY();
                if (y < 0 || y > 255) {
                    wrapper.cancel();
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_17.MAP_DATA, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Map ID
            map(Type.VAR_INT);
            // Scale
            map(Type.BYTE);
            // Tracking position
            handler(wrapper -> wrapper.write(Type.BOOLEAN, true));
            // Locked
            map(Type.BOOLEAN);
            handler(wrapper -> {
                boolean hasMarkers = wrapper.read(Type.BOOLEAN);
                if (!hasMarkers) {
                    // Array size
                    wrapper.write(Type.VAR_INT, 0);
                } else {
                    MapColorRewriter.getRewriteHandler(MapColorRewrites::getMappedColor).handle(wrapper);
                }
            });
        }
    });
}
Also used : ClientboundPackets1_17(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17) MathUtil(com.viaversion.viaversion.util.MathUtil) Arrays(java.util.Arrays) ServerboundPackets1_17(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17) PingRequests(com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.storage.PingRequests) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) LongArrayTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.LongArrayTag) ArrayList(java.util.ArrayList) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Type(com.viaversion.viaversion.api.type.Type) Chunk1_17Type(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type) Chunk(com.viaversion.viaversion.api.minecraft.chunks.Chunk) MapColorRewrites(com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.data.MapColorRewrites) MapColorRewriter(com.viaversion.viabackwards.api.rewriters.MapColorRewriter) Protocol1_16_4To1_17(com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17) Tag(com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag) EntityTracker(com.viaversion.viaversion.api.data.entity.EntityTracker) BlockChangeRecord(com.viaversion.viaversion.api.minecraft.BlockChangeRecord) CompactArrayUtil(com.viaversion.viaversion.util.CompactArrayUtil) ClientboundPackets1_16_2(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2) NumberTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.NumberTag) List(java.util.List) ServerboundPackets1_16_2(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2) BlockRewriter(com.viaversion.viaversion.rewriter.BlockRewriter) ItemRewriter(com.viaversion.viabackwards.api.rewriters.ItemRewriter) Chunk1_16_2Type(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.types.Chunk1_16_2Type) ViaBackwards(com.viaversion.viabackwards.ViaBackwards) CompoundTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag) ChunkSection(com.viaversion.viaversion.api.minecraft.chunks.ChunkSection) BitSet(java.util.BitSet) RecipeRewriter1_16(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16) Chunk1_17Type(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.types.Chunk1_17Type) RecipeRewriter1_16(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16) PingRequests(com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.storage.PingRequests) EntityTracker(com.viaversion.viaversion.api.data.entity.EntityTracker) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) BitSet(java.util.BitSet) MapColorRewrites(com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.data.MapColorRewrites) Chunk(com.viaversion.viaversion.api.minecraft.chunks.Chunk) BlockRewriter(com.viaversion.viaversion.rewriter.BlockRewriter) BlockChangeRecord(com.viaversion.viaversion.api.minecraft.BlockChangeRecord) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) LongArrayTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.LongArrayTag) NumberTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.NumberTag) ArrayList(java.util.ArrayList) List(java.util.List) Chunk1_16_2Type(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.types.Chunk1_16_2Type) LongArrayTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.LongArrayTag) Tag(com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag) NumberTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.NumberTag) CompoundTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag) Protocol1_16_4To1_17(com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.Protocol1_16_4To1_17) ChunkSection(com.viaversion.viaversion.api.minecraft.chunks.ChunkSection) CompoundTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag)

Example 7 with ServerboundPackets1_16_2

use of com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2 in project ViaVersion by ViaVersion.

the class InventoryPackets method registerPackets.

@Override
public void registerPackets() {
    registerSetCooldown(ClientboundPackets1_16_2.COOLDOWN);
    registerWindowItems(ClientboundPackets1_16_2.WINDOW_ITEMS, Type.FLAT_VAR_INT_ITEM_ARRAY);
    registerTradeList(ClientboundPackets1_16_2.TRADE_LIST, Type.FLAT_VAR_INT_ITEM);
    registerSetSlot(ClientboundPackets1_16_2.SET_SLOT, Type.FLAT_VAR_INT_ITEM);
    registerAdvancements(ClientboundPackets1_16_2.ADVANCEMENTS, Type.FLAT_VAR_INT_ITEM);
    registerEntityEquipmentArray(ClientboundPackets1_16_2.ENTITY_EQUIPMENT, Type.FLAT_VAR_INT_ITEM);
    registerSpawnParticle(ClientboundPackets1_16_2.SPAWN_PARTICLE, Type.FLAT_VAR_INT_ITEM, Type.DOUBLE);
    new RecipeRewriter1_16(protocol).registerDefaultHandler(ClientboundPackets1_16_2.DECLARE_RECIPES);
    registerCreativeInvAction(ServerboundPackets1_17.CREATIVE_INVENTORY_ACTION, Type.FLAT_VAR_INT_ITEM);
    protocol.registerServerbound(ServerboundPackets1_17.EDIT_BOOK, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> handleItemToServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)));
        }
    });
    protocol.registerServerbound(ServerboundPackets1_17.CLICK_WINDOW, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Window Id
            map(Type.UNSIGNED_BYTE);
            // Slot
            map(Type.SHORT);
            // Button
            map(Type.BYTE);
            // Action id - doesn't matter, as the sent out confirmation packet will be cancelled
            handler(wrapper -> wrapper.write(Type.SHORT, (short) 0));
            // Action
            map(Type.VAR_INT);
            handler(wrapper -> {
                // Affected items - throw them away!
                int length = wrapper.read(Type.VAR_INT);
                for (int i = 0; i < length; i++) {
                    // Slot
                    wrapper.read(Type.SHORT);
                    wrapper.read(Type.FLAT_VAR_INT_ITEM);
                }
                // 1.17 clients send the then carried item, but 1.16 expects the clicked one
                Item item = wrapper.read(Type.FLAT_VAR_INT_ITEM);
                int action = wrapper.get(Type.VAR_INT, 0);
                if (action == 5 || action == 1) {
                    // Quick craft (= dragging / mouse movement while clicking on an empty slot)
                    // OR Quick move (= shift click to move a whole stack to the other inventory)
                    // The server always expects an empty item here
                    item = null;
                } else {
                    // Use the item sent
                    handleItemToServer(item);
                }
                wrapper.write(Type.FLAT_VAR_INT_ITEM, item);
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_16_2.WINDOW_CONFIRMATION, null, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                short inventoryId = wrapper.read(Type.UNSIGNED_BYTE);
                short confirmationId = wrapper.read(Type.SHORT);
                boolean accepted = wrapper.read(Type.BOOLEAN);
                if (!accepted) {
                    // Use the new ping packet to replace the removed acknowledgement, extra bit for fast dismissal
                    int id = (1 << 30) | (inventoryId << 16) | (confirmationId & 0xFFFF);
                    wrapper.user().get(InventoryAcknowledgements.class).addId(id);
                    PacketWrapper pingPacket = wrapper.create(ClientboundPackets1_17.PING);
                    pingPacket.write(Type.INT, id);
                    pingPacket.send(Protocol1_17To1_16_4.class);
                }
                wrapper.cancel();
            });
        }
    });
    // New pong packet
    protocol.registerServerbound(ServerboundPackets1_17.PONG, null, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                int id = wrapper.read(Type.INT);
                // Check extra bit for fast dismissal
                if ((id & (1 << 30)) != 0 && wrapper.user().get(InventoryAcknowledgements.class).removeId(id)) {
                    // Decode our requested inventory acknowledgement
                    short inventoryId = (short) ((id >> 16) & 0xFF);
                    short confirmationId = (short) (id & 0xFFFF);
                    PacketWrapper packet = wrapper.create(ServerboundPackets1_16_2.WINDOW_CONFIRMATION);
                    packet.write(Type.UNSIGNED_BYTE, inventoryId);
                    packet.write(Type.SHORT, confirmationId);
                    // Accept
                    packet.write(Type.BOOLEAN, true);
                    packet.sendToServer(Protocol1_17To1_16_4.class);
                }
                wrapper.cancel();
            });
        }
    });
}
Also used : PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) ClientboundPackets1_17(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17) Protocol1_17To1_16_4(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4) ItemRewriter(com.viaversion.viaversion.rewriter.ItemRewriter) Type(com.viaversion.viaversion.api.type.Type) ServerboundPackets1_16_2(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2) InventoryAcknowledgements(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.storage.InventoryAcknowledgements) ServerboundPackets1_17(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) Item(com.viaversion.viaversion.api.minecraft.item.Item) RecipeRewriter1_16(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16) ClientboundPackets1_16_2(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2) InventoryAcknowledgements(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.storage.InventoryAcknowledgements) Item(com.viaversion.viaversion.api.minecraft.item.Item) Protocol1_17To1_16_4(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4) RecipeRewriter1_16(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper)

Aggregations

PacketRemapper (com.viaversion.viaversion.api.protocol.remapper.PacketRemapper)7 Type (com.viaversion.viaversion.api.type.Type)7 ServerboundPackets1_16_2 (com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2)6 ClientboundPackets1_16_2 (com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2)5 UserConnection (com.viaversion.viaversion.api.connection.UserConnection)4 PacketWrapper (com.viaversion.viaversion.api.protocol.packet.PacketWrapper)4 BackwardsProtocol (com.viaversion.viabackwards.api.BackwardsProtocol)3 RegistryType (com.viaversion.viaversion.api.minecraft.RegistryType)3 EntityRewriter (com.viaversion.viaversion.api.rewriter.EntityRewriter)3 EntityTrackerBase (com.viaversion.viaversion.data.entity.EntityTrackerBase)3 ClientboundPackets1_16 (com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16)3 StatisticsRewriter (com.viaversion.viaversion.rewriter.StatisticsRewriter)3 TagRewriter (com.viaversion.viaversion.rewriter.TagRewriter)3 ViaBackwards (com.viaversion.viabackwards.ViaBackwards)2 BackwardsMappings (com.viaversion.viabackwards.api.data.BackwardsMappings)2 SoundRewriter (com.viaversion.viabackwards.api.rewriters.SoundRewriter)2 TranslatableRewriter (com.viaversion.viabackwards.api.rewriters.TranslatableRewriter)2 PingRequests (com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.storage.PingRequests)2 Entity1_16_2Types (com.viaversion.viaversion.api.minecraft.entities.Entity1_16_2Types)2 ItemRewriter (com.viaversion.viaversion.api.rewriter.ItemRewriter)2