Search in sources :

Example 1 with ServerboundPackets1_17

use of com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17 in project ViaBackwards by ViaVersion.

the class Protocol1_16_4To1_17 method registerPackets.

@Override
protected void registerPackets() {
    executeAsyncAfterLoaded(Protocol1_17To1_16_4.class, MAPPINGS::load);
    translatableRewriter.registerChatMessage(ClientboundPackets1_17.CHAT_MESSAGE);
    translatableRewriter.registerBossBar(ClientboundPackets1_17.BOSSBAR);
    translatableRewriter.registerDisconnect(ClientboundPackets1_17.DISCONNECT);
    translatableRewriter.registerTabList(ClientboundPackets1_17.TAB_LIST);
    translatableRewriter.registerOpenWindow(ClientboundPackets1_17.OPEN_WINDOW);
    translatableRewriter.registerPing();
    blockItemPackets = new BlockItemPackets1_17(this);
    blockItemPackets.register();
    entityRewriter.register();
    SoundRewriter soundRewriter = new SoundRewriter(this);
    soundRewriter.registerSound(ClientboundPackets1_17.SOUND);
    soundRewriter.registerSound(ClientboundPackets1_17.ENTITY_SOUND);
    soundRewriter.registerNamedSound(ClientboundPackets1_17.NAMED_SOUND);
    soundRewriter.registerStopSound(ClientboundPackets1_17.STOP_SOUND);
    TagRewriter tagRewriter = new TagRewriter(this);
    registerClientbound(ClientboundPackets1_17.TAGS, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                Map<String, List<TagData>> tags = new HashMap<>();
                int length = wrapper.read(Type.VAR_INT);
                for (int i = 0; i < length; i++) {
                    String resourceKey = wrapper.read(Type.STRING);
                    if (resourceKey.startsWith("minecraft:")) {
                        resourceKey = resourceKey.substring(10);
                    }
                    List<TagData> tagList = new ArrayList<>();
                    tags.put(resourceKey, tagList);
                    int tagLength = wrapper.read(Type.VAR_INT);
                    for (int j = 0; j < tagLength; j++) {
                        String identifier = wrapper.read(Type.STRING);
                        int[] entries = wrapper.read(Type.VAR_INT_ARRAY_PRIMITIVE);
                        tagList.add(new TagData(identifier, entries));
                    }
                }
                // Put them into the hardcoded order of Vanilla tags (and only those), rewrite ids
                for (RegistryType type : RegistryType.getValues()) {
                    List<TagData> tagList = tags.get(type.getResourceLocation());
                    IdRewriteFunction rewriter = tagRewriter.getRewriter(type);
                    wrapper.write(Type.VAR_INT, tagList.size());
                    for (TagData tagData : tagList) {
                        int[] entries = tagData.entries();
                        if (rewriter != null) {
                            // Handle id rewriting now
                            IntList idList = new IntArrayList(entries.length);
                            for (int id : entries) {
                                int mappedId = rewriter.rewrite(id);
                                if (mappedId != -1) {
                                    idList.add(mappedId);
                                }
                            }
                            entries = idList.toArray(EMPTY_ARRAY);
                        }
                        wrapper.write(Type.STRING, tagData.identifier());
                        wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, entries);
                    }
                    // Stop after the entity types
                    if (type == RegistryType.ENTITY) {
                        break;
                    }
                }
            });
        }
    });
    new StatisticsRewriter(this).register(ClientboundPackets1_17.STATISTICS);
    registerClientbound(ClientboundPackets1_17.RESOURCE_PACK, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                wrapper.passthrough(Type.STRING);
                wrapper.passthrough(Type.STRING);
                // Required
                wrapper.read(Type.BOOLEAN);
                // Prompt message
                wrapper.read(Type.OPTIONAL_COMPONENT);
            });
        }
    });
    registerClientbound(ClientboundPackets1_17.EXPLOSION, new PacketRemapper() {

        @Override
        public void registerMap() {
            // X
            map(Type.FLOAT);
            // Y
            map(Type.FLOAT);
            // Z
            map(Type.FLOAT);
            // Strength
            map(Type.FLOAT);
            handler(wrapper -> {
                // Collection length
                wrapper.write(Type.INT, wrapper.read(Type.VAR_INT));
            });
        }
    });
    registerClientbound(ClientboundPackets1_17.SPAWN_POSITION, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.POSITION1_14);
            handler(wrapper -> {
                // Angle (which Mojang just forgot to write to the buffer, lol)
                wrapper.read(Type.FLOAT);
            });
        }
    });
    registerClientbound(ClientboundPackets1_17.PING, null, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                wrapper.cancel();
                int id = wrapper.read(Type.INT);
                short shortId = (short) id;
                if (id == shortId && ViaBackwards.getConfig().handlePingsAsInvAcknowledgements()) {
                    wrapper.user().get(PingRequests.class).addId(shortId);
                    // Send inventory acknowledgement to replace ping packet functionality in the unsigned byte range
                    PacketWrapper acknowledgementPacket = wrapper.create(ClientboundPackets1_16_2.WINDOW_CONFIRMATION);
                    // Inventory id
                    acknowledgementPacket.write(Type.UNSIGNED_BYTE, (short) 0);
                    // Confirmation id
                    acknowledgementPacket.write(Type.SHORT, shortId);
                    // Accepted
                    acknowledgementPacket.write(Type.BOOLEAN, false);
                    acknowledgementPacket.send(Protocol1_16_4To1_17.class);
                    return;
                }
                // Plugins expecting a real response will have to handle this accordingly themselves
                PacketWrapper pongPacket = wrapper.create(ServerboundPackets1_17.PONG);
                pongPacket.write(Type.INT, id);
                pongPacket.sendToServer(Protocol1_16_4To1_17.class);
            });
        }
    });
    registerServerbound(ServerboundPackets1_16_2.CLIENT_SETTINGS, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Locale
            map(Type.STRING);
            // View distance
            map(Type.BYTE);
            // Chat mode
            map(Type.VAR_INT);
            // Chat colors
            map(Type.BOOLEAN);
            // Chat flags
            map(Type.UNSIGNED_BYTE);
            // Main hand
            map(Type.VAR_INT);
            handler(wrapper -> {
                // Text filtering
                wrapper.write(Type.BOOLEAN, false);
            });
        }
    });
    // TODO translatables
    mergePacket(ClientboundPackets1_17.TITLE_TEXT, ClientboundPackets1_16_2.TITLE, 0);
    mergePacket(ClientboundPackets1_17.TITLE_SUBTITLE, ClientboundPackets1_16_2.TITLE, 1);
    mergePacket(ClientboundPackets1_17.ACTIONBAR, ClientboundPackets1_16_2.TITLE, 2);
    mergePacket(ClientboundPackets1_17.TITLE_TIMES, ClientboundPackets1_16_2.TITLE, 3);
    registerClientbound(ClientboundPackets1_17.CLEAR_TITLES, ClientboundPackets1_16_2.TITLE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                if (wrapper.read(Type.BOOLEAN)) {
                    // Reset times
                    wrapper.write(Type.VAR_INT, 5);
                } else {
                    // Simple clear
                    wrapper.write(Type.VAR_INT, 4);
                }
            });
        }
    });
    cancelClientbound(ClientboundPackets1_17.ADD_VIBRATION_SIGNAL);
}
Also used : ClientboundPackets1_17(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17) TranslatableRewriter(com.viaversion.viabackwards.api.rewriters.TranslatableRewriter) ServerboundPackets1_17(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17) PingRequests(com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.storage.PingRequests) IdRewriteFunction(com.viaversion.viaversion.rewriter.IdRewriteFunction) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) HashMap(java.util.HashMap) BackwardsProtocol(com.viaversion.viabackwards.api.BackwardsProtocol) ArrayList(java.util.ArrayList) RegistryType(com.viaversion.viaversion.api.minecraft.RegistryType) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Type(com.viaversion.viaversion.api.type.Type) Map(java.util.Map) EntityTrackerBase(com.viaversion.viaversion.data.entity.EntityTrackerBase) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) ItemRewriter(com.viaversion.viaversion.api.rewriter.ItemRewriter) SoundRewriter(com.viaversion.viabackwards.api.rewriters.SoundRewriter) TagData(com.viaversion.viaversion.api.minecraft.TagData) EntityPackets1_17(com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.packets.EntityPackets1_17) ClientboundPackets1_16_2(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2) Protocol1_17To1_16_4(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4) BlockItemPackets1_17(com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.packets.BlockItemPackets1_17) List(java.util.List) Entity1_17Types(com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types) IntArrayList(com.viaversion.viaversion.libs.fastutil.ints.IntArrayList) ServerboundPackets1_16_2(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2) TagRewriter(com.viaversion.viaversion.rewriter.TagRewriter) StatisticsRewriter(com.viaversion.viaversion.rewriter.StatisticsRewriter) BackwardsMappings(com.viaversion.viabackwards.api.data.BackwardsMappings) IntList(com.viaversion.viaversion.libs.fastutil.ints.IntList) ViaBackwards(com.viaversion.viabackwards.ViaBackwards) EntityRewriter(com.viaversion.viaversion.api.rewriter.EntityRewriter) BlockItemPackets1_17(com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.packets.BlockItemPackets1_17) RegistryType(com.viaversion.viaversion.api.minecraft.RegistryType) TagRewriter(com.viaversion.viaversion.rewriter.TagRewriter) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) IntList(com.viaversion.viaversion.libs.fastutil.ints.IntList) StatisticsRewriter(com.viaversion.viaversion.rewriter.StatisticsRewriter) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) TagData(com.viaversion.viaversion.api.minecraft.TagData) SoundRewriter(com.viaversion.viabackwards.api.rewriters.SoundRewriter) ArrayList(java.util.ArrayList) List(java.util.List) IntArrayList(com.viaversion.viaversion.libs.fastutil.ints.IntArrayList) IntList(com.viaversion.viaversion.libs.fastutil.ints.IntList) IdRewriteFunction(com.viaversion.viaversion.rewriter.IdRewriteFunction) IntArrayList(com.viaversion.viaversion.libs.fastutil.ints.IntArrayList) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with ServerboundPackets1_17

use of com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17 in project ViaBackwards by ViaVersion.

the class Protocol1_17To1_17_1 method registerPackets.

@Override
protected void registerPackets() {
    registerClientbound(ClientboundPackets1_17_1.REMOVE_ENTITIES, null, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                int[] entityIds = wrapper.read(Type.VAR_INT_ARRAY_PRIMITIVE);
                wrapper.cancel();
                for (int entityId : entityIds) {
                    // Send individual remove packets
                    PacketWrapper newPacket = wrapper.create(ClientboundPackets1_17.REMOVE_ENTITY);
                    newPacket.write(Type.VAR_INT, entityId);
                    newPacket.send(Protocol1_17To1_17_1.class);
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_17_1.CLOSE_WINDOW, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                short containerId = wrapper.passthrough(Type.UNSIGNED_BYTE);
                wrapper.user().get(InventoryStateIds.class).removeStateId(containerId);
            });
        }
    });
    registerClientbound(ClientboundPackets1_17_1.SET_SLOT, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                short containerId = wrapper.passthrough(Type.UNSIGNED_BYTE);
                int stateId = wrapper.read(Type.VAR_INT);
                wrapper.user().get(InventoryStateIds.class).setStateId(containerId, stateId);
            });
        }
    });
    registerClientbound(ClientboundPackets1_17_1.WINDOW_ITEMS, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                short containerId = wrapper.passthrough(Type.UNSIGNED_BYTE);
                int stateId = wrapper.read(Type.VAR_INT);
                wrapper.user().get(InventoryStateIds.class).setStateId(containerId, stateId);
                // Length is encoded as a var int in 1.17.1
                wrapper.write(Type.FLAT_VAR_INT_ITEM_ARRAY, wrapper.read(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT));
                // Carried item - should work without adding it to the array above
                wrapper.read(Type.FLAT_VAR_INT_ITEM);
            });
        }
    });
    registerServerbound(ServerboundPackets1_17.CLOSE_WINDOW, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                short containerId = wrapper.passthrough(Type.UNSIGNED_BYTE);
                wrapper.user().get(InventoryStateIds.class).removeStateId(containerId);
            });
        }
    });
    registerServerbound(ServerboundPackets1_17.CLICK_WINDOW, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                short containerId = wrapper.passthrough(Type.UNSIGNED_BYTE);
                int stateId = wrapper.user().get(InventoryStateIds.class).removeStateId(containerId);
                wrapper.write(Type.VAR_INT, stateId == Integer.MAX_VALUE ? 0 : stateId);
            });
        }
    });
    registerServerbound(ServerboundPackets1_17.EDIT_BOOK, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                Item item = wrapper.read(Type.FLAT_VAR_INT_ITEM);
                boolean signing = wrapper.read(Type.BOOLEAN);
                // Slot comes first
                wrapper.passthrough(Type.VAR_INT);
                CompoundTag tag = item.tag();
                ListTag pagesTag;
                StringTag titleTag = null;
                // Sanity checks
                if (tag == null || (pagesTag = tag.get("pages")) == null || (signing && (titleTag = tag.get("title")) == null)) {
                    // Pages length
                    wrapper.write(Type.VAR_INT, 0);
                    // Optional title
                    wrapper.write(Type.BOOLEAN, false);
                    return;
                }
                // Write pages - limit them first
                if (pagesTag.size() > MAX_PAGES) {
                    pagesTag = new ListTag(pagesTag.getValue().subList(0, MAX_PAGES));
                }
                wrapper.write(Type.VAR_INT, pagesTag.size());
                for (Tag pageTag : pagesTag) {
                    String page = ((StringTag) pageTag).getValue();
                    // Limit page length
                    if (page.length() > MAX_PAGE_LENGTH) {
                        page = page.substring(0, MAX_PAGE_LENGTH);
                    }
                    wrapper.write(Type.STRING, page);
                }
                // Write optional title
                wrapper.write(Type.BOOLEAN, signing);
                if (signing) {
                    if (titleTag == null) {
                        titleTag = tag.get("title");
                    }
                    // Limit title length
                    String title = titleTag.getValue();
                    if (title.length() > MAX_TITLE_LENGTH) {
                        title = title.substring(0, MAX_TITLE_LENGTH);
                    }
                    wrapper.write(Type.STRING, title);
                }
            });
        }
    });
}
Also used : ClientboundPackets1_17(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17) Tag(com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag) ServerboundPackets1_17(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) StringTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag) Item(com.viaversion.viaversion.api.minecraft.item.Item) ListTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag) BackwardsProtocol(com.viaversion.viabackwards.api.BackwardsProtocol) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Type(com.viaversion.viaversion.api.type.Type) ClientboundPackets1_17_1(com.viaversion.viaversion.protocols.protocol1_17_1to1_17.ClientboundPackets1_17_1) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) CompoundTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag) InventoryStateIds(com.viaversion.viabackwards.protocol.protocol1_17to1_17_1.storage.InventoryStateIds) StringTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag) Item(com.viaversion.viaversion.api.minecraft.item.Item) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Tag(com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag) StringTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag) ListTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag) CompoundTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag) ListTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag) CompoundTag(com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag)

Example 3 with ServerboundPackets1_17

use of com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17 in project ViaVersion by ViaVersion.

the class Protocol1_17_1To1_17 method registerPackets.

@Override
protected void registerPackets() {
    registerClientbound(ClientboundPackets1_17.REMOVE_ENTITY, ClientboundPackets1_17_1.REMOVE_ENTITIES, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                // Aaaaand back to an array again!
                int entityId = wrapper.read(Type.VAR_INT);
                wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, new int[] { entityId });
            });
        }
    });
    registerClientbound(ClientboundPackets1_17.SET_SLOT, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Container id
            map(Type.UNSIGNED_BYTE);
            // Add arbitrary state id
            create(Type.VAR_INT, 0);
        }
    });
    registerClientbound(ClientboundPackets1_17.WINDOW_ITEMS, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Container id
            map(Type.UNSIGNED_BYTE);
            // Add arbitrary state id
            create(Type.VAR_INT, 0);
            handler(wrapper -> {
                // Length encoded as var int now
                wrapper.write(Type.FLAT_VAR_INT_ITEM_ARRAY_VAR_INT, wrapper.read(Type.FLAT_VAR_INT_ITEM_ARRAY));
                // Carried item - should work like this
                wrapper.write(Type.FLAT_VAR_INT_ITEM, null);
            });
        }
    });
    registerServerbound(ServerboundPackets1_17.CLICK_WINDOW, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Container id
            map(Type.UNSIGNED_BYTE);
            // Remove state id
            read(Type.VAR_INT);
        }
    });
    registerServerbound(ServerboundPackets1_17.EDIT_BOOK, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                CompoundTag tag = new CompoundTag();
                // Magic value for writable books
                Item item = new DataItem(942, (byte) 1, (short) 0, tag);
                // Write the item, edit the tag down the line
                wrapper.write(Type.FLAT_VAR_INT_ITEM, item);
                int slot = wrapper.read(Type.VAR_INT);
                // Save pages to tag
                int pages = wrapper.read(Type.VAR_INT);
                ListTag pagesTag = new ListTag(StringTag.class);
                for (int i = 0; i < pages; i++) {
                    String page = wrapper.read(PAGE_STRING_TYPE);
                    pagesTag.add(new StringTag(page));
                }
                // Legacy servers don't like an empty pages list
                if (pagesTag.size() == 0) {
                    pagesTag.add(new StringTag(""));
                }
                tag.put("pages", pagesTag);
                if (wrapper.read(Type.BOOLEAN)) {
                    // Save the title to tag
                    String title = wrapper.read(TITLE_STRING_TYPE);
                    tag.put("title", new StringTag(title));
                    // Even if unused, legacy servers check for the author tag
                    tag.put("author", new StringTag(wrapper.user().getProtocolInfo().getUsername()));
                    // Write signing
                    wrapper.write(Type.BOOLEAN, true);
                } else {
                    wrapper.write(Type.BOOLEAN, false);
                }
                // Write the slot
                wrapper.write(Type.VAR_INT, slot);
            });
        }
    });
}
Also used : StringTag(com.github.steveice10.opennbt.tag.builtin.StringTag) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) ClientboundPackets1_17(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17) Type(com.viaversion.viaversion.api.type.Type) ListTag(com.github.steveice10.opennbt.tag.builtin.ListTag) ServerboundPackets1_17(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17) CompoundTag(com.github.steveice10.opennbt.tag.builtin.CompoundTag) DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem) StringType(com.viaversion.viaversion.api.type.types.StringType) Item(com.viaversion.viaversion.api.minecraft.item.Item) AbstractProtocol(com.viaversion.viaversion.api.protocol.AbstractProtocol) StringTag(com.github.steveice10.opennbt.tag.builtin.StringTag) DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem) Item(com.viaversion.viaversion.api.minecraft.item.Item) DataItem(com.viaversion.viaversion.api.minecraft.item.DataItem) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) ListTag(com.github.steveice10.opennbt.tag.builtin.ListTag) CompoundTag(com.github.steveice10.opennbt.tag.builtin.CompoundTag)

Example 4 with ServerboundPackets1_17

use of com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17 in project ViaVersion by ViaVersion.

the class Protocol1_17To1_16_4 method registerPackets.

@Override
protected void registerPackets() {
    entityRewriter.register();
    itemRewriter.register();
    WorldPackets.register(this);
    registerClientbound(ClientboundPackets1_16_2.TAGS, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                // Tags are now generically written with resource location - 5 different Vanilla types
                wrapper.write(Type.VAR_INT, 5);
                for (RegistryType type : RegistryType.getValues()) {
                    // Prefix with resource location
                    wrapper.write(Type.STRING, type.resourceLocation());
                    // Id conversion
                    tagRewriter.handle(wrapper, tagRewriter.getRewriter(type), tagRewriter.getNewTags(type));
                    // Stop iterating after entity types
                    if (type == RegistryType.ENTITY) {
                        break;
                    }
                }
                // New Game Event tags type
                wrapper.write(Type.STRING, RegistryType.GAME_EVENT.resourceLocation());
                wrapper.write(Type.VAR_INT, NEW_GAME_EVENT_TAGS.length);
                for (String tag : NEW_GAME_EVENT_TAGS) {
                    wrapper.write(Type.STRING, tag);
                    wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, new int[0]);
                }
            });
        }
    });
    new StatisticsRewriter(this).register(ClientboundPackets1_16_2.STATISTICS);
    SoundRewriter soundRewriter = new SoundRewriter(this);
    soundRewriter.registerSound(ClientboundPackets1_16_2.SOUND);
    soundRewriter.registerSound(ClientboundPackets1_16_2.ENTITY_SOUND);
    registerClientbound(ClientboundPackets1_16_2.RESOURCE_PACK, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                wrapper.passthrough(Type.STRING);
                wrapper.passthrough(Type.STRING);
                // Required
                wrapper.write(Type.BOOLEAN, Via.getConfig().isForcedUse1_17ResourcePack());
                // Prompt message
                wrapper.write(Type.OPTIONAL_COMPONENT, Via.getConfig().get1_17ResourcePackPrompt());
            });
        }
    });
    registerClientbound(ClientboundPackets1_16_2.MAP_DATA, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                wrapper.passthrough(Type.VAR_INT);
                wrapper.passthrough(Type.BYTE);
                // Tracking position removed
                wrapper.read(Type.BOOLEAN);
                wrapper.passthrough(Type.BOOLEAN);
                int size = wrapper.read(Type.VAR_INT);
                // Write whether markers exists or not
                if (size != 0) {
                    wrapper.write(Type.BOOLEAN, true);
                    wrapper.write(Type.VAR_INT, size);
                } else {
                    wrapper.write(Type.BOOLEAN, false);
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_16_2.TITLE, null, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                // Title packet actions have been split into individual packets (the content hasn't changed)
                int type = wrapper.read(Type.VAR_INT);
                ClientboundPacketType packetType;
                switch(type) {
                    case 0:
                        packetType = ClientboundPackets1_17.TITLE_TEXT;
                        break;
                    case 1:
                        packetType = ClientboundPackets1_17.TITLE_SUBTITLE;
                        break;
                    case 2:
                        packetType = ClientboundPackets1_17.ACTIONBAR;
                        break;
                    case 3:
                        packetType = ClientboundPackets1_17.TITLE_TIMES;
                        break;
                    case 4:
                        packetType = ClientboundPackets1_17.CLEAR_TITLES;
                        // Reset times
                        wrapper.write(Type.BOOLEAN, false);
                        break;
                    case 5:
                        packetType = ClientboundPackets1_17.CLEAR_TITLES;
                        // Reset times
                        wrapper.write(Type.BOOLEAN, true);
                        break;
                    default:
                        throw new IllegalArgumentException("Invalid title type received: " + type);
                }
                wrapper.setId(packetType.getId());
            });
        }
    });
    registerClientbound(ClientboundPackets1_16_2.EXPLOSION, new PacketRemapper() {

        @Override
        public void registerMap() {
            // X
            map(Type.FLOAT);
            // Y
            map(Type.FLOAT);
            // Z
            map(Type.FLOAT);
            // Strength
            map(Type.FLOAT);
            handler(wrapper -> {
                // Collection length is now a var int
                wrapper.write(Type.VAR_INT, wrapper.read(Type.INT));
            });
        }
    });
    registerClientbound(ClientboundPackets1_16_2.SPAWN_POSITION, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.POSITION1_14);
            handler(wrapper -> {
                // Angle (which Mojang just forgot to write to the buffer, lol)
                wrapper.write(Type.FLOAT, 0f);
            });
        }
    });
    registerServerbound(ServerboundPackets1_17.CLIENT_SETTINGS, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Locale
            map(Type.STRING);
            // View distance
            map(Type.BYTE);
            // Chat mode
            map(Type.VAR_INT);
            // Chat colors
            map(Type.BOOLEAN);
            // Chat flags
            map(Type.UNSIGNED_BYTE);
            // Main hand
            map(Type.VAR_INT);
            handler(wrapper -> {
                // Text filtering
                wrapper.read(Type.BOOLEAN);
            });
        }
    });
}
Also used : MappingData(com.viaversion.viaversion.api.data.MappingData) SoundRewriter(com.viaversion.viaversion.rewriter.SoundRewriter) InventoryPackets(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.packets.InventoryPackets) ParticleType(com.viaversion.viaversion.api.type.types.minecraft.ParticleType) InventoryAcknowledgements(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.storage.InventoryAcknowledgements) WorldPackets(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.packets.WorldPackets) Via(com.viaversion.viaversion.api.Via) AbstractProtocol(com.viaversion.viaversion.api.protocol.AbstractProtocol) Types1_17(com.viaversion.viaversion.api.type.types.version.Types1_17) MappingDataBase(com.viaversion.viaversion.api.data.MappingDataBase) ClientboundPackets1_16_2(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2) RegistryType(com.viaversion.viaversion.api.minecraft.RegistryType) ClientboundPacketType(com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Type(com.viaversion.viaversion.api.type.Type) Entity1_17Types(com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types) ServerboundPackets1_16_2(com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2) TagRewriter(com.viaversion.viaversion.rewriter.TagRewriter) StatisticsRewriter(com.viaversion.viaversion.rewriter.StatisticsRewriter) EntityTrackerBase(com.viaversion.viaversion.data.entity.EntityTrackerBase) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) ItemRewriter(com.viaversion.viaversion.api.rewriter.ItemRewriter) EntityRewriter(com.viaversion.viaversion.api.rewriter.EntityRewriter) EntityPackets(com.viaversion.viaversion.protocols.protocol1_17to1_16_4.packets.EntityPackets) StatisticsRewriter(com.viaversion.viaversion.rewriter.StatisticsRewriter) RegistryType(com.viaversion.viaversion.api.minecraft.RegistryType) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) SoundRewriter(com.viaversion.viaversion.rewriter.SoundRewriter) ClientboundPacketType(com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType)

Example 5 with ServerboundPackets1_17

use of com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17 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)

Aggregations

PacketRemapper (com.viaversion.viaversion.api.protocol.remapper.PacketRemapper)8 Type (com.viaversion.viaversion.api.type.Type)8 ServerboundPackets1_17 (com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17)7 PacketWrapper (com.viaversion.viaversion.api.protocol.packet.PacketWrapper)5 ClientboundPackets1_17 (com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17)5 ClientboundPackets1_16_2 (com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2)4 ServerboundPackets1_16_2 (com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2)4 RecipeRewriter1_16 (com.viaversion.viaversion.protocols.protocol1_16to1_15_2.data.RecipeRewriter1_16)4 UserConnection (com.viaversion.viaversion.api.connection.UserConnection)3 Item (com.viaversion.viaversion.api.minecraft.item.Item)3 ViaBackwards (com.viaversion.viabackwards.ViaBackwards)2 BackwardsProtocol (com.viaversion.viabackwards.api.BackwardsProtocol)2 ItemRewriter (com.viaversion.viabackwards.api.rewriters.ItemRewriter)2 PingRequests (com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.storage.PingRequests)2 ParticleMappings (com.viaversion.viaversion.api.data.ParticleMappings)2 EntityTracker (com.viaversion.viaversion.api.data.entity.EntityTracker)2 RegistryType (com.viaversion.viaversion.api.minecraft.RegistryType)2 Chunk (com.viaversion.viaversion.api.minecraft.chunks.Chunk)2 ChunkSection (com.viaversion.viaversion.api.minecraft.chunks.ChunkSection)2 Entity1_17Types (com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types)2