Search in sources :

Example 1 with BlockItemPackets1_18

use of com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets.BlockItemPackets1_18 in project ViaBackwards by ViaVersion.

the class Protocol1_17_1To1_18 method registerPackets.

@Override
protected void registerPackets() {
    executeAsyncAfterLoaded(Protocol1_18To1_17_1.class, MAPPINGS::load);
    translatableRewriter.registerComponentPacket(ClientboundPackets1_18.CHAT_MESSAGE);
    translatableRewriter.registerComponentPacket(ClientboundPackets1_18.ACTIONBAR);
    translatableRewriter.registerComponentPacket(ClientboundPackets1_18.TITLE_TEXT);
    translatableRewriter.registerComponentPacket(ClientboundPackets1_18.TITLE_SUBTITLE);
    translatableRewriter.registerBossBar(ClientboundPackets1_18.BOSSBAR);
    translatableRewriter.registerDisconnect(ClientboundPackets1_18.DISCONNECT);
    translatableRewriter.registerTabList(ClientboundPackets1_18.TAB_LIST);
    translatableRewriter.registerOpenWindow(ClientboundPackets1_18.OPEN_WINDOW);
    translatableRewriter.registerCombatKill(ClientboundPackets1_18.COMBAT_KILL);
    translatableRewriter.registerPing();
    itemRewriter = new BlockItemPackets1_18(this);
    entityRewriter.register();
    itemRewriter.register();
    final SoundRewriter soundRewriter = new SoundRewriter(this);
    soundRewriter.registerSound(ClientboundPackets1_18.SOUND);
    soundRewriter.registerSound(ClientboundPackets1_18.ENTITY_SOUND);
    soundRewriter.registerStopSound(ClientboundPackets1_18.STOP_SOUND);
    soundRewriter.registerNamedSound(ClientboundPackets1_18.NAMED_SOUND);
    final TagRewriter tagRewriter = new TagRewriter(this);
    tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:lava_pool_stone_replaceables");
    tagRewriter.registerGeneric(ClientboundPackets1_18.TAGS);
    registerServerbound(ServerboundPackets1_17.CLIENT_SETTINGS, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Language
            map(Type.STRING);
            // View distance
            map(Type.BYTE);
            // Chat visibility
            map(Type.VAR_INT);
            // Chat colors
            map(Type.BOOLEAN);
            // Model customization
            map(Type.UNSIGNED_BYTE);
            // Main hand
            map(Type.VAR_INT);
            // Text filtering enabled
            map(Type.BOOLEAN);
            // Allow listing in server list preview
            create(Type.BOOLEAN, true);
        }
    });
    registerClientbound(ClientboundPackets1_18.SCOREBOARD_OBJECTIVE, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Name
            map(Type.STRING);
            handler(cutName(0, 16));
        }
    });
    registerClientbound(ClientboundPackets1_18.DISPLAY_SCOREBOARD, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Slot
            map(Type.BYTE);
            // Name
            map(Type.STRING);
            handler(cutName(0, 16));
        }
    });
    registerClientbound(ClientboundPackets1_18.TEAMS, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Name
            map(Type.STRING);
            handler(cutName(0, 16));
        }
    });
    registerClientbound(ClientboundPackets1_18.UPDATE_SCORE, new PacketRemapper() {

        @Override
        public void registerMap() {
            // Owner
            map(Type.STRING);
            // Method
            map(Type.VAR_INT);
            // Name
            map(Type.STRING);
            handler(cutName(0, 40));
            handler(cutName(1, 16));
        }
    });
}
Also used : TagRewriter(com.viaversion.viaversion.rewriter.TagRewriter) PacketRemapper(com.viaversion.viaversion.api.protocol.remapper.PacketRemapper) SoundRewriter(com.viaversion.viabackwards.api.rewriters.SoundRewriter) BlockItemPackets1_18(com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets.BlockItemPackets1_18)

Aggregations

SoundRewriter (com.viaversion.viabackwards.api.rewriters.SoundRewriter)1 BlockItemPackets1_18 (com.viaversion.viabackwards.protocol.protocol1_17_1to1_18.packets.BlockItemPackets1_18)1 PacketRemapper (com.viaversion.viaversion.api.protocol.remapper.PacketRemapper)1 TagRewriter (com.viaversion.viaversion.rewriter.TagRewriter)1