Search in sources :

Example 26 with Type

use of com.viaversion.viaversion.api.type.Type in project ViaBackwards by ViaVersion.

the class Protocol1_13To1_13_1 method registerPackets.

@Override
protected void registerPackets() {
    executeAsyncAfterLoaded(Protocol1_13_1To1_13.class, MAPPINGS::load);
    entityRewriter.register();
    itemRewriter.register();
    WorldPackets1_13_1.register(this);
    TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
    translatableRewriter.registerChatMessage(ClientboundPackets1_13.CHAT_MESSAGE);
    translatableRewriter.registerCombatEvent(ClientboundPackets1_13.COMBAT_EVENT);
    translatableRewriter.registerDisconnect(ClientboundPackets1_13.DISCONNECT);
    translatableRewriter.registerTabList(ClientboundPackets1_13.TAB_LIST);
    translatableRewriter.registerTitle(ClientboundPackets1_13.TITLE);
    translatableRewriter.registerPing();
    new CommandRewriter1_13_1(this).registerDeclareCommands(ClientboundPackets1_13.DECLARE_COMMANDS);
    registerServerbound(ServerboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.VAR_INT);
            map(Type.STRING, new ValueTransformer<String, String>(Type.STRING) {

                @Override
                public String transform(PacketWrapper wrapper, String inputValue) {
                    // 1.13 starts sending slash at start, so we remove it for compatibility
                    return !inputValue.startsWith("/") ? "/" + inputValue : inputValue;
                }
            });
        }
    });
    registerServerbound(ServerboundPackets1_13.EDIT_BOOK, new PacketRemapper() {

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

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    itemRewriter.handleItemToServer(wrapper.get(Type.FLAT_ITEM, 0));
                    wrapper.write(Type.VAR_INT, 0);
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_13.OPEN_WINDOW, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Id
            map(Type.UNSIGNED_BYTE);
            // Window Type
            map(Type.STRING);
            handler(wrapper -> {
                JsonElement title = wrapper.passthrough(Type.COMPONENT);
                translatableRewriter.processText(title);
                if (ViaBackwards.getConfig().fix1_13FormattedInventoryTitle()) {
                    if (title.isJsonObject() && title.getAsJsonObject().size() == 1 && title.getAsJsonObject().has("translate")) {
                        // Hotfix simple translatable components from being converted to legacy text
                        return;
                    }
                    // https://bugs.mojang.com/browse/MC-124543
                    JsonObject legacyComponent = new JsonObject();
                    legacyComponent.addProperty("text", ChatRewriter.jsonToLegacyText(title.toString()));
                    wrapper.set(Type.COMPONENT, 0, legacyComponent);
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Transaction id
            map(Type.VAR_INT);
            // Start
            map(Type.VAR_INT);
            // Length
            map(Type.VAR_INT);
            // Count
            map(Type.VAR_INT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int start = wrapper.get(Type.VAR_INT, 1);
                    // Offset by +1 to take into account / at beginning
                    wrapper.set(Type.VAR_INT, 1, start - 1);
                    // Passthrough suggestions
                    int count = wrapper.get(Type.VAR_INT, 3);
                    for (int i = 0; i < count; i++) {
                        wrapper.passthrough(Type.STRING);
                        boolean hasTooltip = wrapper.passthrough(Type.BOOLEAN);
                        if (hasTooltip) {
                            // JSON Tooltip
                            wrapper.passthrough(Type.STRING);
                        }
                    }
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_13.BOSSBAR, new PacketRemapper() {

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

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int action = wrapper.get(Type.VAR_INT, 0);
                    if (action == 0 || action == 3) {
                        translatableRewriter.processText(wrapper.passthrough(Type.COMPONENT));
                        if (action == 0) {
                            wrapper.passthrough(Type.FLOAT);
                            wrapper.passthrough(Type.VAR_INT);
                            wrapper.passthrough(Type.VAR_INT);
                            short flags = wrapper.read(Type.UNSIGNED_BYTE);
                            if ((flags & 0x04) != 0)
                                flags |= 0x02;
                            wrapper.write(Type.UNSIGNED_BYTE, flags);
                        }
                    }
                }
            });
        }
    });
    registerClientbound(ClientboundPackets1_13.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
                            wrapper.passthrough(Type.COMPONENT);
                            // Description
                            wrapper.passthrough(Type.COMPONENT);
                            Item icon = wrapper.passthrough(Type.FLAT_ITEM);
                            itemRewriter.handleItemToClient(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);
                        }
                    }
                }
            });
        }
    });
    new TagRewriter(this).register(ClientboundPackets1_13.TAGS, RegistryType.ITEM);
    new StatisticsRewriter(this).register(ClientboundPackets1_13.STATISTICS);
}
Also used : ValueTransformer(com.viaversion.viaversion.api.protocol.remapper.ValueTransformer) PacketHandler(com.viaversion.viaversion.api.protocol.remapper.PacketHandler) TranslatableRewriter(com.viaversion.viabackwards.api.rewriters.TranslatableRewriter) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) Entity1_13Types(com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types) Item(com.viaversion.viaversion.api.minecraft.item.Item) BackwardsProtocol(com.viaversion.viabackwards.api.BackwardsProtocol) RegistryType(com.viaversion.viaversion.api.minecraft.RegistryType) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Type(com.viaversion.viaversion.api.type.Type) ServerboundPackets1_13(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13) EntityTrackerBase(com.viaversion.viaversion.data.entity.EntityTrackerBase) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) ValueTransformer(com.viaversion.viaversion.api.protocol.remapper.ValueTransformer) ItemRewriter(com.viaversion.viaversion.api.rewriter.ItemRewriter) CommandRewriter1_13_1(com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.data.CommandRewriter1_13_1) JsonElement(com.viaversion.viaversion.libs.gson.JsonElement) InventoryPackets1_13_1(com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.packets.InventoryPackets1_13_1) ClientWorld(com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld) WorldPackets1_13_1(com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.packets.WorldPackets1_13_1) EntityPackets1_13_1(com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.packets.EntityPackets1_13_1) ClientboundPackets1_13(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13) JsonObject(com.viaversion.viaversion.libs.gson.JsonObject) TagRewriter(com.viaversion.viaversion.rewriter.TagRewriter) StatisticsRewriter(com.viaversion.viaversion.rewriter.StatisticsRewriter) BackwardsMappings(com.viaversion.viabackwards.api.data.BackwardsMappings) ChatRewriter(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter) ViaBackwards(com.viaversion.viabackwards.ViaBackwards) EntityRewriter(com.viaversion.viaversion.api.rewriter.EntityRewriter) Protocol1_13_1To1_13(com.viaversion.viaversion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13) CommandRewriter1_13_1(com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.data.CommandRewriter1_13_1) TranslatableRewriter(com.viaversion.viabackwards.api.rewriters.TranslatableRewriter) TagRewriter(com.viaversion.viaversion.rewriter.TagRewriter) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) JsonObject(com.viaversion.viaversion.libs.gson.JsonObject) Item(com.viaversion.viaversion.api.minecraft.item.Item) StatisticsRewriter(com.viaversion.viaversion.rewriter.StatisticsRewriter) PacketHandler(com.viaversion.viaversion.api.protocol.remapper.PacketHandler) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) JsonElement(com.viaversion.viaversion.libs.gson.JsonElement)

Example 27 with Type

use of com.viaversion.viaversion.api.type.Type in project ViaBackwards by ViaVersion.

the class Protocol1_15_2To1_16 method registerPackets.

@Override
protected void registerPackets() {
    executeAsyncAfterLoaded(Protocol1_16To1_15_2.class, MAPPINGS::load);
    translatableRewriter.registerBossBar(ClientboundPackets1_16.BOSSBAR);
    translatableRewriter.registerCombatEvent(ClientboundPackets1_16.COMBAT_EVENT);
    translatableRewriter.registerDisconnect(ClientboundPackets1_16.DISCONNECT);
    translatableRewriter.registerTabList(ClientboundPackets1_16.TAB_LIST);
    translatableRewriter.registerTitle(ClientboundPackets1_16.TITLE);
    translatableRewriter.registerPing();
    new CommandRewriter1_16(this).registerDeclareCommands(ClientboundPackets1_16.DECLARE_COMMANDS);
    (blockItemPackets = new BlockItemPackets1_16(this)).register();
    entityRewriter.register();
    registerClientbound(State.STATUS, 0x00, 0x00, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                String original = wrapper.passthrough(Type.STRING);
                JsonObject object = GsonUtil.getGson().fromJson(original, JsonObject.class);
                JsonElement description = object.get("description");
                if (description == null)
                    return;
                translatableRewriter.processText(description);
                wrapper.set(Type.STRING, 0, object.toString());
            });
        }
    });
    registerClientbound(ClientboundPackets1_16.CHAT_MESSAGE, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> translatableRewriter.processText(wrapper.passthrough(Type.COMPONENT)));
            map(Type.BYTE);
            // Sender
            map(Type.UUID, Type.NOTHING);
        }
    });
    registerClientbound(ClientboundPackets1_16.OPEN_WINDOW, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Window Id
            map(Type.VAR_INT);
            // Window Type
            map(Type.VAR_INT);
            handler(wrapper -> translatableRewriter.processText(wrapper.passthrough(Type.COMPONENT)));
            handler(wrapper -> {
                int windowType = wrapper.get(Type.VAR_INT, 1);
                if (windowType == 20) {
                    // Smithing table
                    // Open anvil inventory
                    wrapper.set(Type.VAR_INT, 1, 7);
                } else if (windowType > 20) {
                    wrapper.set(Type.VAR_INT, 1, --windowType);
                }
            });
        }
    });
    SoundRewriter soundRewriter = new SoundRewriter(this);
    soundRewriter.registerSound(ClientboundPackets1_16.SOUND);
    soundRewriter.registerSound(ClientboundPackets1_16.ENTITY_SOUND);
    soundRewriter.registerNamedSound(ClientboundPackets1_16.NAMED_SOUND);
    soundRewriter.registerStopSound(ClientboundPackets1_16.STOP_SOUND);
    // Login success
    registerClientbound(State.LOGIN, 0x02, 0x02, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                // Transform int array to plain string
                UUID uuid = wrapper.read(Type.UUID_INT_ARRAY);
                wrapper.write(Type.STRING, uuid.toString());
            });
        }
    });
    new TagRewriter(this).register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY);
    new StatisticsRewriter(this).register(ClientboundPackets1_16.STATISTICS);
    registerServerbound(ServerboundPackets1_14.ENTITY_ACTION, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                // player id
                wrapper.passthrough(Type.VAR_INT);
                int action = wrapper.passthrough(Type.VAR_INT);
                if (action == 0) {
                    wrapper.user().get(PlayerSneakStorage.class).setSneaking(true);
                } else if (action == 1) {
                    wrapper.user().get(PlayerSneakStorage.class).setSneaking(false);
                }
            });
        }
    });
    registerServerbound(ServerboundPackets1_14.INTERACT_ENTITY, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                // Entity Id
                wrapper.passthrough(Type.VAR_INT);
                int action = wrapper.passthrough(Type.VAR_INT);
                if (action == 0 || action == 2) {
                    if (action == 2) {
                        // Location
                        wrapper.passthrough(Type.FLOAT);
                        wrapper.passthrough(Type.FLOAT);
                        wrapper.passthrough(Type.FLOAT);
                    }
                    // Hand
                    wrapper.passthrough(Type.VAR_INT);
                }
                // New boolean: Whether the client is sneaking
                wrapper.write(Type.BOOLEAN, wrapper.user().get(PlayerSneakStorage.class).isSneaking());
            });
        }
    });
    registerServerbound(ServerboundPackets1_14.PLAYER_ABILITIES, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                byte flags = wrapper.read(Type.BYTE);
                // Only take the isFlying value (everything else has been removed and wasn't used anyways)
                flags &= 2;
                wrapper.write(Type.BYTE, flags);
                wrapper.read(Type.FLOAT);
                wrapper.read(Type.FLOAT);
            });
        }
    });
    cancelServerbound(ServerboundPackets1_14.UPDATE_JIGSAW_BLOCK);
}
Also used : TranslatableRewriter(com.viaversion.viabackwards.api.rewriters.TranslatableRewriter) WorldNameTracker(com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.data.WorldNameTracker) TranslatableRewriter1_16(com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.chat.TranslatableRewriter1_16) GsonUtil(com.viaversion.viaversion.util.GsonUtil) BackwardsProtocol(com.viaversion.viabackwards.api.BackwardsProtocol) Protocol1_16To1_15_2(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2) RegistryType(com.viaversion.viaversion.api.minecraft.RegistryType) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Type(com.viaversion.viaversion.api.type.Type) Entity1_16Types(com.viaversion.viaversion.api.minecraft.entities.Entity1_16Types) EntityTrackerBase(com.viaversion.viaversion.data.entity.EntityTrackerBase) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) BackwardsMappings(com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.data.BackwardsMappings) PlayerSneakStorage(com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.storage.PlayerSneakStorage) SoundRewriter(com.viaversion.viabackwards.api.rewriters.SoundRewriter) JsonElement(com.viaversion.viaversion.libs.gson.JsonElement) CommandRewriter1_16(com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.data.CommandRewriter1_16) State(com.viaversion.viaversion.api.protocol.packet.State) ClientWorld(com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld) UUID(java.util.UUID) ServerboundPackets1_14(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14) ClientboundPackets1_16(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16) JsonObject(com.viaversion.viaversion.libs.gson.JsonObject) ServerboundPackets1_16(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16) TagRewriter(com.viaversion.viaversion.rewriter.TagRewriter) EntityPackets1_16(com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.packets.EntityPackets1_16) StatisticsRewriter(com.viaversion.viaversion.rewriter.StatisticsRewriter) BlockItemPackets1_16(com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.packets.BlockItemPackets1_16) ClientboundPackets1_15(com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15) EntityRewriter(com.viaversion.viaversion.api.rewriter.EntityRewriter) BlockItemPackets1_16(com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.packets.BlockItemPackets1_16) TagRewriter(com.viaversion.viaversion.rewriter.TagRewriter) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) JsonObject(com.viaversion.viaversion.libs.gson.JsonObject) CommandRewriter1_16(com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.data.CommandRewriter1_16) StatisticsRewriter(com.viaversion.viaversion.rewriter.StatisticsRewriter) JsonElement(com.viaversion.viaversion.libs.gson.JsonElement) PlayerSneakStorage(com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.storage.PlayerSneakStorage) SoundRewriter(com.viaversion.viabackwards.api.rewriters.SoundRewriter) UUID(java.util.UUID)

Example 28 with Type

use of com.viaversion.viaversion.api.type.Type in project ViaVersion by ViaVersion.

the class WorldPackets method register.

public static void register(Protocol1_14To1_13_2 protocol) {
    BlockRewriter blockRewriter = new BlockRewriter(protocol, null);
    protocol.registerClientbound(ClientboundPackets1_13.BLOCK_BREAK_ANIMATION, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.VAR_INT);
            map(Type.POSITION, Type.POSITION1_14);
            map(Type.BYTE);
        }
    });
    protocol.registerClientbound(ClientboundPackets1_13.BLOCK_ENTITY_DATA, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.POSITION, Type.POSITION1_14);
        }
    });
    protocol.registerClientbound(ClientboundPackets1_13.BLOCK_ACTION, new PacketRemapper() {

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

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    wrapper.set(Type.VAR_INT, 0, protocol.getMappingData().getNewBlockId(wrapper.get(Type.VAR_INT, 0)));
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_13.BLOCK_CHANGE, new PacketRemapper() {

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

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    int id = wrapper.get(Type.VAR_INT, 0);
                    wrapper.set(Type.VAR_INT, 0, protocol.getMappingData().getNewBlockStateId(id));
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_13.SERVER_DIFFICULTY, new PacketRemapper() {

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

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    // Added in 19w11a. Maybe https://bugs.mojang.com/browse/MC-44471 ?
                    wrapper.write(Type.BOOLEAN, false);
                }
            });
        }
    });
    blockRewriter.registerMultiBlockChange(ClientboundPackets1_13.MULTI_BLOCK_CHANGE);
    protocol.registerClientbound(ClientboundPackets1_13.EXPLOSION, new PacketRemapper() {

        @Override
        public void registerMap() {
            // X
            map(Type.FLOAT);
            // Y
            map(Type.FLOAT);
            // Z
            map(Type.FLOAT);
            // Radius
            map(Type.FLOAT);
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    for (int i = 0; i < 3; i++) {
                        float coord = wrapper.get(Type.FLOAT, i);
                        if (coord < 0f) {
                            coord = (int) coord;
                            wrapper.set(Type.FLOAT, i, coord);
                        }
                    }
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_13.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);
                    Chunk chunk = wrapper.read(new Chunk1_13Type(clientWorld));
                    wrapper.write(new Chunk1_14Type(), chunk);
                    int[] motionBlocking = new int[16 * 16];
                    int[] worldSurface = new int[16 * 16];
                    for (int s = 0; s < chunk.getSections().length; s++) {
                        ChunkSection section = chunk.getSections()[s];
                        if (section == null)
                            continue;
                        boolean hasBlock = false;
                        for (int i = 0; i < section.getPaletteSize(); i++) {
                            int old = section.getPaletteEntry(i);
                            int newId = protocol.getMappingData().getNewBlockStateId(old);
                            if (!hasBlock && newId != air && newId != voidAir && newId != caveAir) {
                                // air, void_air, cave_air
                                hasBlock = true;
                            }
                            section.setPaletteEntry(i, newId);
                        }
                        if (!hasBlock) {
                            section.setNonAirBlocksCount(0);
                            continue;
                        }
                        int nonAirBlockCount = 0;
                        for (int x = 0; x < 16; x++) {
                            for (int y = 0; y < 16; y++) {
                                for (int z = 0; z < 16; z++) {
                                    int id = section.getFlatBlock(x, y, z);
                                    if (id != air && id != voidAir && id != caveAir) {
                                        nonAirBlockCount++;
                                        // +1 (top of the block)
                                        worldSurface[x + z * 16] = y + s * 16 + 1;
                                    }
                                    if (protocol.getMappingData().getMotionBlocking().contains(id)) {
                                        // +1 (top of the block)
                                        motionBlocking[x + z * 16] = y + s * 16 + 1;
                                    }
                                    // Manually update light for non full blocks (block light must not be sent)
                                    if (Via.getConfig().isNonFullBlockLightFix() && protocol.getMappingData().getNonFullBlocks().contains(id)) {
                                        setNonFullLight(chunk, section, s, x, y, z);
                                    }
                                }
                            }
                        }
                        section.setNonAirBlocksCount(nonAirBlockCount);
                    }
                    CompoundTag heightMap = new CompoundTag();
                    heightMap.put("MOTION_BLOCKING", new LongArrayTag(encodeHeightMap(motionBlocking)));
                    heightMap.put("WORLD_SURFACE", new LongArrayTag(encodeHeightMap(worldSurface)));
                    chunk.setHeightMap(heightMap);
                    PacketWrapper lightPacket = wrapper.create(ClientboundPackets1_14.UPDATE_LIGHT);
                    lightPacket.write(Type.VAR_INT, chunk.getX());
                    lightPacket.write(Type.VAR_INT, chunk.getZ());
                    // all 18 bits set if ground up
                    int skyLightMask = chunk.isFullChunk() ? 0x3ffff : 0;
                    int blockLightMask = 0;
                    for (int i = 0; i < chunk.getSections().length; i++) {
                        ChunkSection sec = chunk.getSections()[i];
                        if (sec == null)
                            continue;
                        if (!chunk.isFullChunk() && sec.getLight().hasSkyLight()) {
                            skyLightMask |= (1 << (i + 1));
                        }
                        blockLightMask |= (1 << (i + 1));
                    }
                    lightPacket.write(Type.VAR_INT, skyLightMask);
                    lightPacket.write(Type.VAR_INT, blockLightMask);
                    // empty sky light mask
                    lightPacket.write(Type.VAR_INT, 0);
                    // empty block light mask
                    lightPacket.write(Type.VAR_INT, 0);
                    // only do this on the initial chunk send (not when chunk.isGroundUp() is false)
                    if (chunk.isFullChunk())
                        // chunk below 0
                        lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, FULL_LIGHT);
                    for (ChunkSection section : chunk.getSections()) {
                        if (section == null || !section.getLight().hasSkyLight()) {
                            if (chunk.isFullChunk()) {
                                lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, FULL_LIGHT);
                            }
                            continue;
                        }
                        lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, section.getLight().getSkyLight());
                    }
                    if (chunk.isFullChunk())
                        // chunk above 255
                        lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, FULL_LIGHT);
                    for (ChunkSection section : chunk.getSections()) {
                        if (section == null)
                            continue;
                        lightPacket.write(Type.BYTE_ARRAY_PRIMITIVE, section.getLight().getBlockLight());
                    }
                    EntityTracker1_14 entityTracker = wrapper.user().getEntityTracker(Protocol1_14To1_13_2.class);
                    int diffX = Math.abs(entityTracker.getChunkCenterX() - chunk.getX());
                    int diffZ = Math.abs(entityTracker.getChunkCenterZ() - chunk.getZ());
                    if (entityTracker.isForceSendCenterChunk() || diffX >= SERVERSIDE_VIEW_DISTANCE || diffZ >= SERVERSIDE_VIEW_DISTANCE) {
                        // Set center chunk
                        PacketWrapper fakePosLook = wrapper.create(ClientboundPackets1_14.UPDATE_VIEW_POSITION);
                        fakePosLook.write(Type.VAR_INT, chunk.getX());
                        fakePosLook.write(Type.VAR_INT, chunk.getZ());
                        fakePosLook.send(Protocol1_14To1_13_2.class);
                        entityTracker.setChunkCenterX(chunk.getX());
                        entityTracker.setChunkCenterZ(chunk.getZ());
                    }
                    lightPacket.send(Protocol1_14To1_13_2.class);
                    // Remove light references from chunk sections
                    for (ChunkSection section : chunk.getSections()) {
                        if (section != null) {
                            section.setLight(null);
                        }
                    }
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_13.EFFECT, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Effect Id
            map(Type.INT);
            // Location
            map(Type.POSITION, Type.POSITION1_14);
            // 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, protocol.getMappingData().getNewItemId(data));
                    } else if (id == 2001) {
                        // Block break + block break sound
                        wrapper.set(Type.INT, 1, protocol.getMappingData().getNewBlockStateId(data));
                    }
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_13.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
                    ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
                    int dimensionId = wrapper.get(Type.INT, 1);
                    clientChunks.setEnvironment(dimensionId);
                    int entityId = wrapper.get(Type.INT, 0);
                    Entity1_14Types entType = Entity1_14Types.PLAYER;
                    // Register Type ID
                    EntityTracker1_14 tracker = wrapper.user().getEntityTracker(Protocol1_14To1_13_2.class);
                    tracker.addEntity(entityId, entType);
                    tracker.setClientEntityId(entityId);
                }
            });
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    // 19w11a removed difficulty from join game
                    short difficulty = wrapper.read(Type.UNSIGNED_BYTE);
                    PacketWrapper difficultyPacket = wrapper.create(ClientboundPackets1_14.SERVER_DIFFICULTY);
                    difficultyPacket.write(Type.UNSIGNED_BYTE, difficulty);
                    // Unknown value added in 19w11a
                    difficultyPacket.write(Type.BOOLEAN, false);
                    difficultyPacket.scheduleSend(protocol.getClass());
                    // Max Players
                    wrapper.passthrough(Type.UNSIGNED_BYTE);
                    // Level Type
                    wrapper.passthrough(Type.STRING);
                    // Serverside view distance, added in 19w13a
                    wrapper.write(Type.VAR_INT, SERVERSIDE_VIEW_DISTANCE);
                }
            });
            handler(wrapper -> {
                // Manually send the packet
                wrapper.send(Protocol1_14To1_13_2.class);
                wrapper.cancel();
                // View distance has to be sent after the join packet
                sendViewDistancePacket(wrapper.user());
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_13.MAP_DATA, new PacketRemapper() {

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

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    // new value, probably if the map is locked (added in 19w02a), old maps are not locked
                    wrapper.write(Type.BOOLEAN, false);
                }
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_13.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);
                    EntityTracker1_14 entityTracker = wrapper.user().getEntityTracker(Protocol1_14To1_13_2.class);
                    // The client may reset the center chunk if dimension is changed
                    entityTracker.setForceSendCenterChunk(true);
                }
            });
            handler(new PacketHandler() {

                @Override
                public void handle(PacketWrapper wrapper) throws Exception {
                    // 19w11a removed difficulty from respawn
                    short difficulty = wrapper.read(Type.UNSIGNED_BYTE);
                    PacketWrapper difficultyPacket = wrapper.create(ClientboundPackets1_14.SERVER_DIFFICULTY);
                    difficultyPacket.write(Type.UNSIGNED_BYTE, difficulty);
                    // Unknown value added in 19w11a
                    difficultyPacket.write(Type.BOOLEAN, false);
                    difficultyPacket.scheduleSend(protocol.getClass());
                }
            });
            handler(wrapper -> {
                // Manually send the packet and update the viewdistance after
                wrapper.send(Protocol1_14To1_13_2.class);
                wrapper.cancel();
                sendViewDistancePacket(wrapper.user());
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_13.SPAWN_POSITION, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.POSITION, Type.POSITION1_14);
        }
    });
}
Also used : PacketHandler(com.viaversion.viaversion.api.protocol.remapper.PacketHandler) Arrays(java.util.Arrays) EntityTracker1_14(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14) ClientWorld(com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) Chunk1_14Type(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type) Via(com.viaversion.viaversion.api.Via) CompactArrayUtil(com.viaversion.viaversion.util.CompactArrayUtil) NibbleArray(com.viaversion.viaversion.api.minecraft.chunks.NibbleArray) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) ClientboundPackets1_13(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13) Type(com.viaversion.viaversion.api.type.Type) Chunk(com.viaversion.viaversion.api.minecraft.chunks.Chunk) BlockRewriter(com.viaversion.viaversion.rewriter.BlockRewriter) Protocol1_14To1_13_2(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2) CompoundTag(com.github.steveice10.opennbt.tag.builtin.CompoundTag) LongArrayTag(com.github.steveice10.opennbt.tag.builtin.LongArrayTag) UserConnection(com.viaversion.viaversion.api.connection.UserConnection) BlockFace(com.viaversion.viaversion.api.minecraft.BlockFace) ChunkSection(com.viaversion.viaversion.api.minecraft.chunks.ChunkSection) ClientboundPackets1_14(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14) Chunk1_13Type(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type) Entity1_14Types(com.viaversion.viaversion.api.minecraft.entities.Entity1_14Types) EntityTracker1_14(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.storage.EntityTracker1_14) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Chunk1_14Type(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type) Chunk(com.viaversion.viaversion.api.minecraft.chunks.Chunk) BlockRewriter(com.viaversion.viaversion.rewriter.BlockRewriter) PacketHandler(com.viaversion.viaversion.api.protocol.remapper.PacketHandler) PacketWrapper(com.viaversion.viaversion.api.protocol.packet.PacketWrapper) Chunk1_13Type(com.viaversion.viaversion.protocols.protocol1_13to1_12_2.types.Chunk1_13Type) LongArrayTag(com.github.steveice10.opennbt.tag.builtin.LongArrayTag) Entity1_14Types(com.viaversion.viaversion.api.minecraft.entities.Entity1_14Types) Protocol1_14To1_13_2(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2) ClientWorld(com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld) ChunkSection(com.viaversion.viaversion.api.minecraft.chunks.ChunkSection) CompoundTag(com.github.steveice10.opennbt.tag.builtin.CompoundTag)

Example 29 with Type

use of com.viaversion.viaversion.api.type.Type in project ViaVersion by ViaVersion.

the class PlayerPackets method register.

public static void register(Protocol protocol) {
    protocol.registerClientbound(ClientboundPackets1_14.RESPAWN, new PacketRemapper() {

        @Override
        public void registerMap() {
            map(Type.INT);
            // Level Seed
            handler(wrapper -> wrapper.write(Type.LONG, 0L));
        }
    });
    protocol.registerClientbound(ClientboundPackets1_14.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(wrapper -> {
                // Register Type ID
                EntityTracker tracker = wrapper.user().getEntityTracker(Protocol1_15To1_14_4.class);
                int entityId = wrapper.get(Type.INT, 0);
                tracker.addEntity(entityId, Entity1_15Types.PLAYER);
            });
            // Level Seed
            handler(wrapper -> wrapper.write(Type.LONG, 0L));
            // 3 - Max Players
            map(Type.UNSIGNED_BYTE);
            // 4 - Level Type
            map(Type.STRING);
            // 5 - View Distance
            map(Type.VAR_INT);
            // 6 - Reduce Debug Info
            map(Type.BOOLEAN);
            // Show Death Screen
            handler(wrapper -> wrapper.write(Type.BOOLEAN, !Via.getConfig().is1_15InstantRespawn()));
        }
    });
}
Also used : PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Type(com.viaversion.viaversion.api.type.Type) Entity1_15Types(com.viaversion.viaversion.api.minecraft.entities.Entity1_15Types) Protocol1_15To1_14_4(com.viaversion.viaversion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4) EntityTracker(com.viaversion.viaversion.api.data.entity.EntityTracker) Protocol(com.viaversion.viaversion.api.protocol.Protocol) ClientboundPackets1_14(com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14) Via(com.viaversion.viaversion.api.Via) EntityTracker(com.viaversion.viaversion.api.data.entity.EntityTracker) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) Protocol1_15To1_14_4(com.viaversion.viaversion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4)

Example 30 with Type

use of com.viaversion.viaversion.api.type.Type in project ViaVersion by ViaVersion.

the class EntityPackets method register.

public static void register(Protocol1_16To1_15_2 protocol) {
    MetadataRewriter1_16To1_15_2 metadataRewriter = protocol.get(MetadataRewriter1_16To1_15_2.class);
    // Spawn lightning -> Spawn entity
    protocol.registerClientbound(ClientboundPackets1_15.SPAWN_GLOBAL_ENTITY, ClientboundPackets1_16.SPAWN_ENTITY, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                int entityId = wrapper.passthrough(Type.VAR_INT);
                byte type = wrapper.read(Type.BYTE);
                if (type != 1) {
                    // Cancel if not lightning/invalid id
                    wrapper.cancel();
                    return;
                }
                wrapper.user().getEntityTracker(Protocol1_16To1_15_2.class).addEntity(entityId, Entity1_16Types.LIGHTNING_BOLT);
                // uuid
                wrapper.write(Type.UUID, UUID.randomUUID());
                // entity type
                wrapper.write(Type.VAR_INT, Entity1_16Types.LIGHTNING_BOLT.getId());
                // x
                wrapper.passthrough(Type.DOUBLE);
                // y
                wrapper.passthrough(Type.DOUBLE);
                // z
                wrapper.passthrough(Type.DOUBLE);
                // yaw
                wrapper.write(Type.BYTE, (byte) 0);
                // pitch
                wrapper.write(Type.BYTE, (byte) 0);
                // data
                wrapper.write(Type.INT, 0);
                // velocity
                wrapper.write(Type.SHORT, (short) 0);
                // velocity
                wrapper.write(Type.SHORT, (short) 0);
                // velocity
                wrapper.write(Type.SHORT, (short) 0);
            });
        }
    });
    metadataRewriter.registerTrackerWithData(ClientboundPackets1_15.SPAWN_ENTITY, Entity1_16Types.FALLING_BLOCK);
    metadataRewriter.registerTracker(ClientboundPackets1_15.SPAWN_MOB);
    metadataRewriter.registerTracker(ClientboundPackets1_15.SPAWN_PLAYER, Entity1_16Types.PLAYER);
    metadataRewriter.registerMetadataRewriter(ClientboundPackets1_15.ENTITY_METADATA, Types1_14.METADATA_LIST, Types1_16.METADATA_LIST);
    metadataRewriter.registerRemoveEntities(ClientboundPackets1_15.DESTROY_ENTITIES);
    protocol.registerClientbound(ClientboundPackets1_15.RESPAWN, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(DIMENSION_HANDLER);
            // Seed
            map(Type.LONG);
            // Gamemode
            map(Type.UNSIGNED_BYTE);
            handler(wrapper -> {
                // Previous gamemode, set to none
                wrapper.write(Type.BYTE, (byte) -1);
                String levelType = wrapper.read(Type.STRING);
                // debug
                wrapper.write(Type.BOOLEAN, false);
                wrapper.write(Type.BOOLEAN, levelType.equals("flat"));
                // keep all playerdata
                wrapper.write(Type.BOOLEAN, true);
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_15.JOIN_GAME, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Entity ID
            map(Type.INT);
            // Gamemode
            map(Type.UNSIGNED_BYTE);
            handler(wrapper -> {
                // Previous gamemode, set to none
                wrapper.write(Type.BYTE, (byte) -1);
                // World list - only used for command completion
                wrapper.write(Type.STRING_ARRAY, Arrays.copyOf(WORLD_NAMES, WORLD_NAMES.length));
                // Dimension registry
                wrapper.write(Type.NBT, DIMENSIONS_TAG.clone());
            });
            // Dimension
            handler(DIMENSION_HANDLER);
            // Seed
            map(Type.LONG);
            // Max players
            map(Type.UNSIGNED_BYTE);
            handler(wrapper -> {
                wrapper.user().getEntityTracker(Protocol1_16To1_15_2.class).addEntity(wrapper.get(Type.INT, 0), Entity1_16Types.PLAYER);
                // level type
                final String type = wrapper.read(Type.STRING);
                // View distance
                wrapper.passthrough(Type.VAR_INT);
                // Reduced debug info
                wrapper.passthrough(Type.BOOLEAN);
                // Show death screen
                wrapper.passthrough(Type.BOOLEAN);
                // Debug
                wrapper.write(Type.BOOLEAN, false);
                wrapper.write(Type.BOOLEAN, type.equals("flat"));
            });
        }
    });
    protocol.registerClientbound(ClientboundPackets1_15.ENTITY_PROPERTIES, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                wrapper.passthrough(Type.VAR_INT);
                int size = wrapper.passthrough(Type.INT);
                int actualSize = size;
                for (int i = 0; i < size; i++) {
                    // Attributes have been renamed and are now namespaced identifiers
                    String key = wrapper.read(Type.STRING);
                    String attributeIdentifier = protocol.getMappingData().getAttributeMappings().get(key);
                    if (attributeIdentifier == null) {
                        attributeIdentifier = "minecraft:" + key;
                        if (!com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.MappingData.isValid1_13Channel(attributeIdentifier)) {
                            if (!Via.getConfig().isSuppressConversionWarnings()) {
                                Via.getPlatform().getLogger().warning("Invalid attribute: " + key);
                            }
                            actualSize--;
                            wrapper.read(Type.DOUBLE);
                            int modifierSize = wrapper.read(Type.VAR_INT);
                            for (int j = 0; j < modifierSize; j++) {
                                wrapper.read(Type.UUID);
                                wrapper.read(Type.DOUBLE);
                                wrapper.read(Type.BYTE);
                            }
                            continue;
                        }
                    }
                    wrapper.write(Type.STRING, attributeIdentifier);
                    wrapper.passthrough(Type.DOUBLE);
                    int modifierSize = wrapper.passthrough(Type.VAR_INT);
                    for (int j = 0; j < modifierSize; j++) {
                        wrapper.passthrough(Type.UUID);
                        wrapper.passthrough(Type.DOUBLE);
                        wrapper.passthrough(Type.BYTE);
                    }
                }
                if (size != actualSize) {
                    wrapper.set(Type.INT, 0, actualSize);
                }
            });
        }
    });
    protocol.registerServerbound(ServerboundPackets1_16.ANIMATION, new PacketRemapper() {

        @Override
        public void registerMap() {
            handler(wrapper -> {
                InventoryTracker1_16 inventoryTracker = wrapper.user().get(InventoryTracker1_16.class);
                // Don't send an arm swing if the player has an inventory opened.
                if (inventoryTracker.getInventory() != -1) {
                    wrapper.cancel();
                }
            });
        }
    });
}
Also used : PacketHandler(com.viaversion.viaversion.api.protocol.remapper.PacketHandler) ByteTag(com.github.steveice10.opennbt.tag.builtin.ByteTag) Arrays(java.util.Arrays) ListTag(com.github.steveice10.opennbt.tag.builtin.ListTag) UUID(java.util.UUID) Via(com.viaversion.viaversion.api.Via) IntTag(com.github.steveice10.opennbt.tag.builtin.IntTag) Types1_14(com.viaversion.viaversion.api.type.types.version.Types1_14) Protocol1_16To1_15_2(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2) Types1_16(com.viaversion.viaversion.api.type.types.version.Types1_16) StringTag(com.github.steveice10.opennbt.tag.builtin.StringTag) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) ClientboundPackets1_16(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16) WorldIdentifiers(com.viaversion.viaversion.api.minecraft.WorldIdentifiers) Type(com.viaversion.viaversion.api.type.Type) ServerboundPackets1_16(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16) InventoryTracker1_16(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.storage.InventoryTracker1_16) LongTag(com.github.steveice10.opennbt.tag.builtin.LongTag) Entity1_16Types(com.viaversion.viaversion.api.minecraft.entities.Entity1_16Types) CompoundTag(com.github.steveice10.opennbt.tag.builtin.CompoundTag) ClientboundPackets1_15(com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15) MetadataRewriter1_16To1_15_2(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.metadata.MetadataRewriter1_16To1_15_2) FloatTag(com.github.steveice10.opennbt.tag.builtin.FloatTag) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) InventoryTracker1_16(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.storage.InventoryTracker1_16) MetadataRewriter1_16To1_15_2(com.viaversion.viaversion.protocols.protocol1_16to1_15_2.metadata.MetadataRewriter1_16To1_15_2)

Aggregations

Type (com.viaversion.viaversion.api.type.Type)36 PacketRemapper (com.viaversion.viaversion.api.protocol.remapper.PacketRemapper)33 PacketWrapper (com.viaversion.viaversion.api.protocol.packet.PacketWrapper)28 PacketHandler (com.viaversion.viaversion.api.protocol.remapper.PacketHandler)23 Via (com.viaversion.viaversion.api.Via)14 Item (com.viaversion.viaversion.api.minecraft.item.Item)14 ClientWorld (com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld)13 UserConnection (com.viaversion.viaversion.api.connection.UserConnection)11 ClientboundPackets1_13 (com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13)11 Metadata (com.viaversion.viaversion.api.minecraft.metadata.Metadata)10 EntityType (com.viaversion.viaversion.api.minecraft.entities.EntityType)9 CompoundTag (com.github.steveice10.opennbt.tag.builtin.CompoundTag)8 ViaBackwards (com.viaversion.viabackwards.ViaBackwards)8 Position (com.viaversion.viaversion.api.minecraft.Position)8 Chunk (com.viaversion.viaversion.api.minecraft.chunks.Chunk)8 ClientboundPackets1_14 (com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14)8 List (java.util.List)8 ChunkSection (com.viaversion.viaversion.api.minecraft.chunks.ChunkSection)7 ClientboundPackets1_15 (com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15)7 ArrayList (java.util.ArrayList)7