Add 1.16.2->combat test 8c protocol

This commit is contained in:
FlorianMichael 2024-07-20 00:00:36 +02:00
parent 5f4e5e2a1a
commit 3a9b481351
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
2 changed files with 52 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.Protocol3D_Sharew
import net.raphimc.viaaprilfools.protocol.scombattest8ctov1_16_2.ProtocolCombatTest8cTo1_16_2;
import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.Protocol20w14infiniteTo1_16;
import net.raphimc.viaaprilfools.protocol.v1_14tos3d_shareware.Protocol1_14To3D_Shareware;
import net.raphimc.viaaprilfools.protocol.v1_16_2toscombattest8c.Protocol1_16_2ToCombatTest8c;
import java.io.File;
import java.util.logging.Logger;
@ -43,8 +44,11 @@ public interface ViaAprilFoolsPlatform {
final ProtocolManager protocolManager = Via.getManager().getProtocolManager();
protocolManager.registerProtocol(new Protocol3D_SharewareTo1_14(), ProtocolVersion.v1_14, AprilFoolsProtocolVersion.s3d_shareware);
protocolManager.registerProtocol(new Protocol1_14To3D_Shareware(), AprilFoolsProtocolVersion.s3d_shareware, ProtocolVersion.v1_14);
protocolManager.registerProtocol(new Protocol20w14infiniteTo1_16(), ProtocolVersion.v1_16, AprilFoolsProtocolVersion.s20w14infinite);
protocolManager.registerProtocol(new ProtocolCombatTest8cTo1_16_2(), ProtocolVersion.v1_16_2, AprilFoolsProtocolVersion.sCombatTest8c);
protocolManager.registerProtocol(new Protocol1_16_2ToCombatTest8c(), AprilFoolsProtocolVersion.sCombatTest8c, ProtocolVersion.v1_16_2);
}
Logger getLogger();

View File

@ -0,0 +1,48 @@
/*
* This file is part of ViaAprilFools - https://github.com/RaphiMC/ViaAprilFools
* Copyright (C) 2021-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.viaaprilfools.protocol.v1_16_2toscombattest8c;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ClientboundPackets1_16_2;
import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ServerboundPackets1_16_2;
public class Protocol1_16_2ToCombatTest8c extends AbstractProtocol<ClientboundPackets1_16_2, ClientboundPackets1_16_2, ServerboundPackets1_16_2, ServerboundPackets1_16_2> {
public Protocol1_16_2ToCombatTest8c() {
super(ClientboundPackets1_16_2.class, ClientboundPackets1_16_2.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16_2.class);
}
@Override
protected void registerPackets() {
this.registerServerbound(ServerboundPackets1_16_2.CLIENT_INFORMATION, new PacketHandlers() {
@Override
public void register() {
map(Types.STRING); //language
map(Types.BYTE); //viewDistance
map(Types.VAR_INT); //chatVisibility
map(Types.BOOLEAN); //chatColors
map(Types.UNSIGNED_BYTE); //playerModelBitMask
map(Types.VAR_INT); //mainArm
read(Types.BOOLEAN); //useShieldOnCrouch
}
});
}
}