Update to new packetlib changes

This commit is contained in:
RednedEpic 2021-11-13 13:52:39 -06:00
parent 87c0953d27
commit c5032fb425
3 changed files with 249 additions and 215 deletions

52
Jenkinsfile vendored Normal file
View file

@ -0,0 +1,52 @@
pipeline {
agent any
tools {
maven 'Maven 3'
jdk 'Java 8'
}
options {
buildDiscarder(logRotator(artifactNumToKeepStr: '20'))
}
stages {
stage ('Build') {
steps {
sh 'mvn clean package'
}
post {
success {
archiveArtifacts artifacts: 'target/*.jar', excludes: 'target/*-sources.jar', fingerprint: true
}
}
}
stage ('Deploy') {
when {
branch "master"
}
steps {
rtMavenDeployer(
id: "maven-deployer",
serverId: "opencollab-artifactory",
releaseRepo: "maven-releases",
snapshotRepo: "maven-snapshots"
)
rtMavenResolver(
id: "maven-resolver",
serverId: "opencollab-artifactory",
releaseRepo: "maven-deploy-release",
snapshotRepo: "maven-deploy-snapshot"
)
rtMavenRun(
pom: 'pom.xml',
goals: 'javadoc:jar source:jar install -DskipTests',
deployerId: "maven-deployer",
resolverId: "maven-resolver"
)
rtPublishBuildInfo(
serverId: "opencollab-artifactory"
)
}
}
}
}

20
pom.xml
View file

@ -47,6 +47,26 @@
</issueManagement> </issueManagement>
<repositories> <repositories>
<repository>
<id>opencollab-release-repo</id>
<url>https://repo.opencollab.dev/maven-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>opencollab-snapshot-repo</id>
<url>https://repo.opencollab.dev/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository> <repository>
<id>jitpack.io</id> <id>jitpack.io</id>
<url>https://jitpack.io</url> <url>https://jitpack.io</url>

View file

@ -3,30 +3,7 @@ package com.github.steveice10.mc.protocol;
import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.auth.data.GameProfile;
import com.github.steveice10.mc.protocol.data.SubProtocol; import com.github.steveice10.mc.protocol.data.SubProtocol;
import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket; import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundAwardStatsPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.*;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundBossEventPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChangeDifficultyPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCommandSuggestionsPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCommandsPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCooldownPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisconnectPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundKeepAlivePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPingPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRecipePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundResourcePackPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSelectAdvancementsTabPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSetCameraPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSoundEntityPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundStopSoundPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundTabListPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateAdvancementsPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateRecipesPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundAnimatePacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundAnimatePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundEntityEventPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundEntityEventPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosPacket;
@ -60,28 +37,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddMobPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddMobPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPaintingPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPaintingPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPlayerPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPlayerPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundAddVibrationSignalPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.*;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockDestructionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockEntityDataPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockEventPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockUpdatePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundCustomSoundPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundExplodePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundForgetLevelChunkPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundGameEventPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelParticlesPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLightUpdatePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundOpenSignEditorPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheCenterPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheRadiusPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetDefaultSpawnPositionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetTimePacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSoundPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundTagQueryPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundInitializeBorderPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundInitializeBorderPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderCenterPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderCenterPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderLerpSizePacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderLerpSizePacket;
@ -172,6 +128,7 @@ import com.github.steveice10.packetlib.crypt.AESEncryption;
import com.github.steveice10.packetlib.crypt.PacketEncryption; import com.github.steveice10.packetlib.crypt.PacketEncryption;
import com.github.steveice10.packetlib.packet.DefaultPacketHeader; import com.github.steveice10.packetlib.packet.DefaultPacketHeader;
import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.packet.Packet;
import com.github.steveice10.packetlib.packet.PacketFactory;
import com.github.steveice10.packetlib.packet.PacketHeader; import com.github.steveice10.packetlib.packet.PacketHeader;
import com.github.steveice10.packetlib.packet.PacketProtocol; import com.github.steveice10.packetlib.packet.PacketProtocol;
import lombok.Getter; import lombok.Getter;
@ -181,7 +138,6 @@ import lombok.Setter;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import java.security.Key; import java.security.Key;
import java.util.UUID; import java.util.UUID;
import java.util.function.BiConsumer;
/** /**
* Implements the Minecraft protocol. * Implements the Minecraft protocol.
@ -334,185 +290,191 @@ public class MinecraftProtocol extends PacketProtocol {
} }
private void initClientHandshake() { private void initClientHandshake() {
this.registerOutgoing(0, ClientIntentionPacket.class); this.registerOutgoing(0, ClientIntentionPacket.class, ClientIntentionPacket::new);
} }
private void initServerHandshake() { private void initServerHandshake() {
this.registerIncoming(0, ClientIntentionPacket.class); this.registerIncoming(0, ClientIntentionPacket.class, ClientIntentionPacket::new);
} }
private void initLogin(BiConsumer<Integer, Class<? extends Packet>> clientboundPackets, BiConsumer<Integer, Class<? extends Packet>> serverboundPackets) { private void initLogin(PacketRegisterFactory clientboundPackets, PacketRegisterFactory serverboundPackets) {
clientboundPackets.accept(0x00, ClientboundLoginDisconnectPacket.class); clientboundPackets.register(0x00, ClientboundLoginDisconnectPacket.class, ClientboundLoginDisconnectPacket::new);
clientboundPackets.accept(0x01, ClientboundHelloPacket.class); clientboundPackets.register(0x01, ClientboundHelloPacket.class, ClientboundHelloPacket::new);
clientboundPackets.accept(0x02, ClientboundGameProfilePacket.class); clientboundPackets.register(0x02, ClientboundGameProfilePacket.class, ClientboundGameProfilePacket::new);
clientboundPackets.accept(0x03, ClientboundLoginCompressionPacket.class); clientboundPackets.register(0x03, ClientboundLoginCompressionPacket.class, ClientboundLoginCompressionPacket::new);
clientboundPackets.accept(0x04, ClientboundCustomQueryPacket.class); clientboundPackets.register(0x04, ClientboundCustomQueryPacket.class, ClientboundCustomQueryPacket::new);
serverboundPackets.accept(0x00, ServerboundHelloPacket.class); serverboundPackets.register(0x00, ServerboundHelloPacket.class, ServerboundHelloPacket::new);
serverboundPackets.accept(0x01, ServerboundKeyPacket.class); serverboundPackets.register(0x01, ServerboundKeyPacket.class, ServerboundKeyPacket::new);
serverboundPackets.accept(0x02, ServerboundCustomQueryPacket.class); serverboundPackets.register(0x02, ServerboundCustomQueryPacket.class, ServerboundCustomQueryPacket::new);
} }
private void initGame(BiConsumer<Integer, Class<? extends Packet>> clientboundPackets, BiConsumer<Integer, Class<? extends Packet>> serverboundPackets) { private void initGame(PacketRegisterFactory clientboundPackets, PacketRegisterFactory serverboundPackets) {
clientboundPackets.accept(0x00, ClientboundAddEntityPacket.class); clientboundPackets.register(0x00, ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new);
clientboundPackets.accept(0x01, ClientboundAddExperienceOrbPacket.class); clientboundPackets.register(0x01, ClientboundAddExperienceOrbPacket.class, ClientboundAddExperienceOrbPacket::new);
clientboundPackets.accept(0x02, ClientboundAddMobPacket.class); clientboundPackets.register(0x02, ClientboundAddMobPacket.class, ClientboundAddMobPacket::new);
clientboundPackets.accept(0x03, ClientboundAddPaintingPacket.class); clientboundPackets.register(0x03, ClientboundAddPaintingPacket.class, ClientboundAddPaintingPacket::new);
clientboundPackets.accept(0x04, ClientboundAddPlayerPacket.class); clientboundPackets.register(0x04, ClientboundAddPlayerPacket.class, ClientboundAddPlayerPacket::new);
clientboundPackets.accept(0x05, ClientboundAddVibrationSignalPacket.class); clientboundPackets.register(0x05, ClientboundAddVibrationSignalPacket.class, ClientboundAddVibrationSignalPacket::new);
clientboundPackets.accept(0x06, ClientboundAnimatePacket.class); clientboundPackets.register(0x06, ClientboundAnimatePacket.class, ClientboundAnimatePacket::new);
clientboundPackets.accept(0x07, ClientboundAwardStatsPacket.class); clientboundPackets.register(0x07, ClientboundAwardStatsPacket.class, ClientboundAwardStatsPacket::new);
clientboundPackets.accept(0x08, ClientboundBlockBreakAckPacket.class); clientboundPackets.register(0x08, ClientboundBlockBreakAckPacket.class, ClientboundBlockBreakAckPacket::new);
clientboundPackets.accept(0x09, ClientboundBlockDestructionPacket.class); clientboundPackets.register(0x09, ClientboundBlockDestructionPacket.class, ClientboundBlockDestructionPacket::new);
clientboundPackets.accept(0x0A, ClientboundBlockEntityDataPacket.class); clientboundPackets.register(0x0A, ClientboundBlockEntityDataPacket.class, ClientboundBlockEntityDataPacket::new);
clientboundPackets.accept(0x0B, ClientboundBlockEventPacket.class); clientboundPackets.register(0x0B, ClientboundBlockEventPacket.class, ClientboundBlockEventPacket::new);
clientboundPackets.accept(0x0C, ClientboundBlockUpdatePacket.class); clientboundPackets.register(0x0C, ClientboundBlockUpdatePacket.class, ClientboundBlockUpdatePacket::new);
clientboundPackets.accept(0x0D, ClientboundBossEventPacket.class); clientboundPackets.register(0x0D, ClientboundBossEventPacket.class, ClientboundBossEventPacket::new);
clientboundPackets.accept(0x0E, ClientboundChangeDifficultyPacket.class); clientboundPackets.register(0x0E, ClientboundChangeDifficultyPacket.class, ClientboundChangeDifficultyPacket::new);
clientboundPackets.accept(0x0F, ClientboundChatPacket.class); clientboundPackets.register(0x0F, ClientboundChatPacket.class, ClientboundChatPacket::new);
clientboundPackets.accept(0x10, ClientboundClearTitlesPacket.class); clientboundPackets.register(0x10, ClientboundClearTitlesPacket.class, ClientboundClearTitlesPacket::new);
clientboundPackets.accept(0x11, ClientboundCommandSuggestionsPacket.class); clientboundPackets.register(0x11, ClientboundCommandSuggestionsPacket.class, ClientboundCommandSuggestionsPacket::new);
clientboundPackets.accept(0x12, ClientboundCommandsPacket.class); clientboundPackets.register(0x12, ClientboundCommandsPacket.class, ClientboundCommandsPacket::new);
clientboundPackets.accept(0x13, ClientboundContainerClosePacket.class); clientboundPackets.register(0x13, ClientboundContainerClosePacket.class, ClientboundContainerClosePacket::new);
clientboundPackets.accept(0x14, ClientboundContainerSetContentPacket.class); clientboundPackets.register(0x14, ClientboundContainerSetContentPacket.class, ClientboundContainerSetContentPacket::new);
clientboundPackets.accept(0x15, ClientboundContainerSetDataPacket.class); clientboundPackets.register(0x15, ClientboundContainerSetDataPacket.class, ClientboundContainerSetDataPacket::new);
clientboundPackets.accept(0x16, ClientboundContainerSetSlotPacket.class); clientboundPackets.register(0x16, ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new);
clientboundPackets.accept(0x17, ClientboundCooldownPacket.class); clientboundPackets.register(0x17, ClientboundCooldownPacket.class, ClientboundCooldownPacket::new);
clientboundPackets.accept(0x18, ClientboundCustomPayloadPacket.class); clientboundPackets.register(0x18, ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new);
clientboundPackets.accept(0x19, ClientboundCustomSoundPacket.class); clientboundPackets.register(0x19, ClientboundCustomSoundPacket.class, ClientboundCustomSoundPacket::new);
clientboundPackets.accept(0x1A, ClientboundDisconnectPacket.class); clientboundPackets.register(0x1A, ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new);
clientboundPackets.accept(0x1B, ClientboundEntityEventPacket.class); clientboundPackets.register(0x1B, ClientboundEntityEventPacket.class, ClientboundEntityEventPacket::new);
clientboundPackets.accept(0x1C, ClientboundExplodePacket.class); clientboundPackets.register(0x1C, ClientboundExplodePacket.class, ClientboundExplodePacket::new);
clientboundPackets.accept(0x1D, ClientboundForgetLevelChunkPacket.class); clientboundPackets.register(0x1D, ClientboundForgetLevelChunkPacket.class, ClientboundForgetLevelChunkPacket::new);
clientboundPackets.accept(0x1E, ClientboundGameEventPacket.class); clientboundPackets.register(0x1E, ClientboundGameEventPacket.class, ClientboundGameEventPacket::new);
clientboundPackets.accept(0x1F, ClientboundHorseScreenOpenPacket.class); clientboundPackets.register(0x1F, ClientboundHorseScreenOpenPacket.class, ClientboundHorseScreenOpenPacket::new);
clientboundPackets.accept(0x20, ClientboundInitializeBorderPacket.class); clientboundPackets.register(0x20, ClientboundInitializeBorderPacket.class, ClientboundInitializeBorderPacket::new);
clientboundPackets.accept(0x21, ClientboundKeepAlivePacket.class); clientboundPackets.register(0x21, ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new);
clientboundPackets.accept(0x22, ClientboundLevelChunkPacket.class); clientboundPackets.register(0x22, ClientboundLevelChunkPacket.class, ClientboundLevelChunkPacket::new);
clientboundPackets.accept(0x23, ClientboundLevelEventPacket.class); clientboundPackets.register(0x23, ClientboundLevelEventPacket.class, ClientboundLevelEventPacket::new);
clientboundPackets.accept(0x24, ClientboundLevelParticlesPacket.class); clientboundPackets.register(0x24, ClientboundLevelParticlesPacket.class, ClientboundLevelParticlesPacket::new);
clientboundPackets.accept(0x25, ClientboundLightUpdatePacket.class); clientboundPackets.register(0x25, ClientboundLightUpdatePacket.class, ClientboundLightUpdatePacket::new);
clientboundPackets.accept(0x26, ClientboundLoginPacket.class); clientboundPackets.register(0x26, ClientboundLoginPacket.class, ClientboundLoginPacket::new);
clientboundPackets.accept(0x27, ClientboundMapItemDataPacket.class); clientboundPackets.register(0x27, ClientboundMapItemDataPacket.class, ClientboundMapItemDataPacket::new);
clientboundPackets.accept(0x28, ClientboundMerchantOffersPacket.class); clientboundPackets.register(0x28, ClientboundMerchantOffersPacket.class, ClientboundMerchantOffersPacket::new);
clientboundPackets.accept(0x29, ClientboundMoveEntityPosPacket.class); clientboundPackets.register(0x29, ClientboundMoveEntityPosPacket.class, ClientboundMoveEntityPosPacket::new);
clientboundPackets.accept(0x2A, ClientboundMoveEntityPosRotPacket.class); clientboundPackets.register(0x2A, ClientboundMoveEntityPosRotPacket.class, ClientboundMoveEntityPosRotPacket::new);
clientboundPackets.accept(0x2B, ClientboundMoveEntityRotPacket.class); clientboundPackets.register(0x2B, ClientboundMoveEntityRotPacket.class, ClientboundMoveEntityRotPacket::new);
clientboundPackets.accept(0x2C, ClientboundMoveVehiclePacket.class); clientboundPackets.register(0x2C, ClientboundMoveVehiclePacket.class, ClientboundMoveVehiclePacket::new);
clientboundPackets.accept(0x2D, ClientboundOpenBookPacket.class); clientboundPackets.register(0x2D, ClientboundOpenBookPacket.class, ClientboundOpenBookPacket::new);
clientboundPackets.accept(0x2E, ClientboundOpenScreenPacket.class); clientboundPackets.register(0x2E, ClientboundOpenScreenPacket.class, ClientboundOpenScreenPacket::new);
clientboundPackets.accept(0x2F, ClientboundOpenSignEditorPacket.class); clientboundPackets.register(0x2F, ClientboundOpenSignEditorPacket.class, ClientboundOpenSignEditorPacket::new);
clientboundPackets.accept(0x30, ClientboundPingPacket.class); clientboundPackets.register(0x30, ClientboundPingPacket.class, ClientboundPingPacket::new);
clientboundPackets.accept(0x31, ClientboundPlaceGhostRecipePacket.class); clientboundPackets.register(0x31, ClientboundPlaceGhostRecipePacket.class, ClientboundPlaceGhostRecipePacket::new);
clientboundPackets.accept(0x32, ClientboundPlayerAbilitiesPacket.class); clientboundPackets.register(0x32, ClientboundPlayerAbilitiesPacket.class, ClientboundPlayerAbilitiesPacket::new);
clientboundPackets.accept(0x33, ClientboundPlayerCombatEndPacket.class); clientboundPackets.register(0x33, ClientboundPlayerCombatEndPacket.class, ClientboundPlayerCombatEndPacket::new);
clientboundPackets.accept(0x34, ClientboundPlayerCombatEnterPacket.class); clientboundPackets.register(0x34, ClientboundPlayerCombatEnterPacket.class, ClientboundPlayerCombatEnterPacket::new);
clientboundPackets.accept(0x35, ClientboundPlayerCombatKillPacket.class); clientboundPackets.register(0x35, ClientboundPlayerCombatKillPacket.class, ClientboundPlayerCombatKillPacket::new);
clientboundPackets.accept(0x36, ClientboundPlayerInfoPacket.class); clientboundPackets.register(0x36, ClientboundPlayerInfoPacket.class, ClientboundPlayerInfoPacket::new);
clientboundPackets.accept(0x37, ClientboundPlayerLookAtPacket.class); clientboundPackets.register(0x37, ClientboundPlayerLookAtPacket.class, ClientboundPlayerLookAtPacket::new);
clientboundPackets.accept(0x38, ClientboundPlayerPositionPacket.class); clientboundPackets.register(0x38, ClientboundPlayerPositionPacket.class, ClientboundPlayerPositionPacket::new);
clientboundPackets.accept(0x39, ClientboundRecipePacket.class); clientboundPackets.register(0x39, ClientboundRecipePacket.class, ClientboundRecipePacket::new);
clientboundPackets.accept(0x3A, ClientboundRemoveEntitiesPacket.class); clientboundPackets.register(0x3A, ClientboundRemoveEntitiesPacket.class, ClientboundRemoveEntitiesPacket::new);
clientboundPackets.accept(0x3B, ClientboundRemoveMobEffectPacket.class); clientboundPackets.register(0x3B, ClientboundRemoveMobEffectPacket.class, ClientboundRemoveMobEffectPacket::new);
clientboundPackets.accept(0x3C, ClientboundResourcePackPacket.class); clientboundPackets.register(0x3C, ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new);
clientboundPackets.accept(0x3D, ClientboundRespawnPacket.class); clientboundPackets.register(0x3D, ClientboundRespawnPacket.class, ClientboundRespawnPacket::new);
clientboundPackets.accept(0x3E, ClientboundRotateHeadPacket.class); clientboundPackets.register(0x3E, ClientboundRotateHeadPacket.class, ClientboundRotateHeadPacket::new);
clientboundPackets.accept(0x3F, ClientboundSectionBlocksUpdatePacket.class); clientboundPackets.register(0x3F, ClientboundSectionBlocksUpdatePacket.class, ClientboundSectionBlocksUpdatePacket::new);
clientboundPackets.accept(0x40, ClientboundSelectAdvancementsTabPacket.class); clientboundPackets.register(0x40, ClientboundSelectAdvancementsTabPacket.class, ClientboundSelectAdvancementsTabPacket::new);
clientboundPackets.accept(0x41, ClientboundSetActionBarTextPacket.class); clientboundPackets.register(0x41, ClientboundSetActionBarTextPacket.class, ClientboundSetActionBarTextPacket::new);
clientboundPackets.accept(0x42, ClientboundSetBorderCenterPacket.class); clientboundPackets.register(0x42, ClientboundSetBorderCenterPacket.class, ClientboundSetBorderCenterPacket::new);
clientboundPackets.accept(0x43, ClientboundSetBorderLerpSizePacket.class); clientboundPackets.register(0x43, ClientboundSetBorderLerpSizePacket.class, ClientboundSetBorderLerpSizePacket::new);
clientboundPackets.accept(0x44, ClientboundSetBorderSizePacket.class); clientboundPackets.register(0x44, ClientboundSetBorderSizePacket.class, ClientboundSetBorderSizePacket::new);
clientboundPackets.accept(0x45, ClientboundSetBorderWarningDelayPacket.class); clientboundPackets.register(0x45, ClientboundSetBorderWarningDelayPacket.class, ClientboundSetBorderWarningDelayPacket::new);
clientboundPackets.accept(0x46, ClientboundSetBorderWarningDistancePacket.class); clientboundPackets.register(0x46, ClientboundSetBorderWarningDistancePacket.class, ClientboundSetBorderWarningDistancePacket::new);
clientboundPackets.accept(0x47, ClientboundSetCameraPacket.class); clientboundPackets.register(0x47, ClientboundSetCameraPacket.class, ClientboundSetCameraPacket::new);
clientboundPackets.accept(0x48, ClientboundSetCarriedItemPacket.class); clientboundPackets.register(0x48, ClientboundSetCarriedItemPacket.class, ClientboundSetCarriedItemPacket::new);
clientboundPackets.accept(0x49, ClientboundSetChunkCacheCenterPacket.class); clientboundPackets.register(0x49, ClientboundSetChunkCacheCenterPacket.class, ClientboundSetChunkCacheCenterPacket::new);
clientboundPackets.accept(0x4A, ClientboundSetChunkCacheRadiusPacket.class); clientboundPackets.register(0x4A, ClientboundSetChunkCacheRadiusPacket.class, ClientboundSetChunkCacheRadiusPacket::new);
clientboundPackets.accept(0x4B, ClientboundSetDefaultSpawnPositionPacket.class); clientboundPackets.register(0x4B, ClientboundSetDefaultSpawnPositionPacket.class, ClientboundSetDefaultSpawnPositionPacket::new);
clientboundPackets.accept(0x4C, ClientboundSetDisplayObjectivePacket.class); clientboundPackets.register(0x4C, ClientboundSetDisplayObjectivePacket.class, ClientboundSetDisplayObjectivePacket::new);
clientboundPackets.accept(0x4D, ClientboundSetEntityDataPacket.class); clientboundPackets.register(0x4D, ClientboundSetEntityDataPacket.class, ClientboundSetEntityDataPacket::new);
clientboundPackets.accept(0x4E, ClientboundSetEntityLinkPacket.class); clientboundPackets.register(0x4E, ClientboundSetEntityLinkPacket.class, ClientboundSetEntityLinkPacket::new);
clientboundPackets.accept(0x4F, ClientboundSetEntityMotionPacket.class); clientboundPackets.register(0x4F, ClientboundSetEntityMotionPacket.class, ClientboundSetEntityMotionPacket::new);
clientboundPackets.accept(0x50, ClientboundSetEquipmentPacket.class); clientboundPackets.register(0x50, ClientboundSetEquipmentPacket.class, ClientboundSetEquipmentPacket::new);
clientboundPackets.accept(0x51, ClientboundSetExperiencePacket.class); clientboundPackets.register(0x51, ClientboundSetExperiencePacket.class, ClientboundSetExperiencePacket::new);
clientboundPackets.accept(0x52, ClientboundSetHealthPacket.class); clientboundPackets.register(0x52, ClientboundSetHealthPacket.class, ClientboundSetHealthPacket::new);
clientboundPackets.accept(0x53, ClientboundSetObjectivePacket.class); clientboundPackets.register(0x53, ClientboundSetObjectivePacket.class, ClientboundSetObjectivePacket::new);
clientboundPackets.accept(0x54, ClientboundSetPassengersPacket.class); clientboundPackets.register(0x54, ClientboundSetPassengersPacket.class, ClientboundSetPassengersPacket::new);
clientboundPackets.accept(0x55, ClientboundSetPlayerTeamPacket.class); clientboundPackets.register(0x55, ClientboundSetPlayerTeamPacket.class, ClientboundSetPlayerTeamPacket::new);
clientboundPackets.accept(0x56, ClientboundSetScorePacket.class); clientboundPackets.register(0x56, ClientboundSetScorePacket.class, ClientboundSetScorePacket::new);
clientboundPackets.accept(0x57, ClientboundSetSubtitleTextPacket.class); clientboundPackets.register(0x57, ClientboundSetSubtitleTextPacket.class, ClientboundSetSubtitleTextPacket::new);
clientboundPackets.accept(0x58, ClientboundSetTimePacket.class); clientboundPackets.register(0x58, ClientboundSetTimePacket.class, ClientboundSetTimePacket::new);
clientboundPackets.accept(0x59, ClientboundSetTitleTextPacket.class); clientboundPackets.register(0x59, ClientboundSetTitleTextPacket.class, ClientboundSetTitleTextPacket::new);
clientboundPackets.accept(0x5A, ClientboundSetTitlesAnimationPacket.class); clientboundPackets.register(0x5A, ClientboundSetTitlesAnimationPacket.class, ClientboundSetTitlesAnimationPacket::new);
clientboundPackets.accept(0x5B, ClientboundSoundEntityPacket.class); clientboundPackets.register(0x5B, ClientboundSoundEntityPacket.class, ClientboundSoundEntityPacket::new);
clientboundPackets.accept(0x5C, ClientboundSoundPacket.class); clientboundPackets.register(0x5C, ClientboundSoundPacket.class, ClientboundSoundPacket::new);
clientboundPackets.accept(0x5D, ClientboundStopSoundPacket.class); clientboundPackets.register(0x5D, ClientboundStopSoundPacket.class, ClientboundStopSoundPacket::new);
clientboundPackets.accept(0x5E, ClientboundTabListPacket.class); clientboundPackets.register(0x5E, ClientboundTabListPacket.class, ClientboundTabListPacket::new);
clientboundPackets.accept(0x5F, ClientboundTagQueryPacket.class); clientboundPackets.register(0x5F, ClientboundTagQueryPacket.class, ClientboundTagQueryPacket::new);
clientboundPackets.accept(0x60, ClientboundTakeItemEntityPacket.class); clientboundPackets.register(0x60, ClientboundTakeItemEntityPacket.class, ClientboundTakeItemEntityPacket::new);
clientboundPackets.accept(0x61, ClientboundTeleportEntityPacket.class); clientboundPackets.register(0x61, ClientboundTeleportEntityPacket.class, ClientboundTeleportEntityPacket::new);
clientboundPackets.accept(0x62, ClientboundUpdateAdvancementsPacket.class); clientboundPackets.register(0x62, ClientboundUpdateAdvancementsPacket.class, ClientboundUpdateAdvancementsPacket::new);
clientboundPackets.accept(0x63, ClientboundUpdateAttributesPacket.class); clientboundPackets.register(0x63, ClientboundUpdateAttributesPacket.class, ClientboundUpdateAttributesPacket::new);
clientboundPackets.accept(0x64, ClientboundUpdateMobEffectPacket.class); clientboundPackets.register(0x64, ClientboundUpdateMobEffectPacket.class, ClientboundUpdateMobEffectPacket::new);
clientboundPackets.accept(0x65, ClientboundUpdateRecipesPacket.class); clientboundPackets.register(0x65, ClientboundUpdateRecipesPacket.class, ClientboundUpdateRecipesPacket::new);
clientboundPackets.accept(0x66, ClientboundUpdateTagsPacket.class); clientboundPackets.register(0x66, ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new);
serverboundPackets.accept(0x00, ServerboundAcceptTeleportationPacket.class); serverboundPackets.register(0x00, ServerboundAcceptTeleportationPacket.class, ServerboundAcceptTeleportationPacket::new);
serverboundPackets.accept(0x01, ServerboundBlockEntityTagQuery.class); serverboundPackets.register(0x01, ServerboundBlockEntityTagQuery.class, ServerboundBlockEntityTagQuery::new);
serverboundPackets.accept(0x02, ServerboundChangeDifficultyPacket.class); serverboundPackets.register(0x02, ServerboundChangeDifficultyPacket.class, ServerboundChangeDifficultyPacket::new);
serverboundPackets.accept(0x03, ServerboundChatPacket.class); serverboundPackets.register(0x03, ServerboundChatPacket.class, ServerboundChatPacket::new);
serverboundPackets.accept(0x04, ServerboundClientCommandPacket.class); serverboundPackets.register(0x04, ServerboundClientCommandPacket.class, ServerboundClientCommandPacket::new);
serverboundPackets.accept(0x05, ServerboundClientInformationPacket.class); serverboundPackets.register(0x05, ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new);
serverboundPackets.accept(0x06, ServerboundCommandSuggestionPacket.class); serverboundPackets.register(0x06, ServerboundCommandSuggestionPacket.class, ServerboundCommandSuggestionPacket::new);
serverboundPackets.accept(0x07, ServerboundContainerButtonClickPacket.class); serverboundPackets.register(0x07, ServerboundContainerButtonClickPacket.class, ServerboundContainerButtonClickPacket::new);
serverboundPackets.accept(0x08, ServerboundContainerClickPacket.class); serverboundPackets.register(0x08, ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new);
serverboundPackets.accept(0x09, ServerboundContainerClosePacket.class); serverboundPackets.register(0x09, ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new);
serverboundPackets.accept(0x0A, ServerboundCustomPayloadPacket.class); serverboundPackets.register(0x0A, ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new);
serverboundPackets.accept(0x0B, ServerboundEditBookPacket.class); serverboundPackets.register(0x0B, ServerboundEditBookPacket.class, ServerboundEditBookPacket::new);
serverboundPackets.accept(0x0C, ServerboundEntityTagQuery.class); serverboundPackets.register(0x0C, ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new);
serverboundPackets.accept(0x0D, ServerboundInteractPacket.class); serverboundPackets.register(0x0D, ServerboundInteractPacket.class, ServerboundInteractPacket::new);
serverboundPackets.accept(0x0E, ServerboundJigsawGeneratePacket.class); serverboundPackets.register(0x0E, ServerboundJigsawGeneratePacket.class, ServerboundJigsawGeneratePacket::new);
serverboundPackets.accept(0x0F, ServerboundKeepAlivePacket.class); serverboundPackets.register(0x0F, ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new);
serverboundPackets.accept(0x10, ServerboundLockDifficultyPacket.class); serverboundPackets.register(0x10, ServerboundLockDifficultyPacket.class, ServerboundLockDifficultyPacket::new);
serverboundPackets.accept(0x11, ServerboundMovePlayerPosPacket.class); serverboundPackets.register(0x11, ServerboundMovePlayerPosPacket.class, ServerboundMovePlayerPosPacket::new);
serverboundPackets.accept(0x12, ServerboundMovePlayerPosRotPacket.class); serverboundPackets.register(0x12, ServerboundMovePlayerPosRotPacket.class, ServerboundMovePlayerPosRotPacket::new);
serverboundPackets.accept(0x13, ServerboundMovePlayerRotPacket.class); serverboundPackets.register(0x13, ServerboundMovePlayerRotPacket.class, ServerboundMovePlayerRotPacket::new);
serverboundPackets.accept(0x14, ServerboundMovePlayerStatusOnlyPacket.class); serverboundPackets.register(0x14, ServerboundMovePlayerStatusOnlyPacket.class, ServerboundMovePlayerStatusOnlyPacket::new);
serverboundPackets.accept(0x15, ServerboundMoveVehiclePacket.class); serverboundPackets.register(0x15, ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new);
serverboundPackets.accept(0x16, ServerboundPaddleBoatPacket.class); serverboundPackets.register(0x16, ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new);
serverboundPackets.accept(0x17, ServerboundPickItemPacket.class); serverboundPackets.register(0x17, ServerboundPickItemPacket.class, ServerboundPickItemPacket::new);
serverboundPackets.accept(0x18, ServerboundPlaceRecipePacket.class); serverboundPackets.register(0x18, ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new);
serverboundPackets.accept(0x19, ServerboundPlayerAbilitiesPacket.class); serverboundPackets.register(0x19, ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new);
serverboundPackets.accept(0x1A, ServerboundPlayerActionPacket.class); serverboundPackets.register(0x1A, ServerboundPlayerActionPacket.class, ServerboundPlayerActionPacket::new);
serverboundPackets.accept(0x1B, ServerboundPlayerCommandPacket.class); serverboundPackets.register(0x1B, ServerboundPlayerCommandPacket.class, ServerboundPlayerCommandPacket::new);
serverboundPackets.accept(0x1C, ServerboundPlayerInputPacket.class); serverboundPackets.register(0x1C, ServerboundPlayerInputPacket.class, ServerboundPlayerInputPacket::new);
serverboundPackets.accept(0x1D, ServerboundPongPacket.class); serverboundPackets.register(0x1D, ServerboundPongPacket.class, ServerboundPongPacket::new);
serverboundPackets.accept(0x1E, ServerboundRecipeBookChangeSettingsPacket.class); serverboundPackets.register(0x1E, ServerboundRecipeBookChangeSettingsPacket.class, ServerboundRecipeBookChangeSettingsPacket::new);
serverboundPackets.accept(0x1F, ServerboundRecipeBookSeenRecipePacket.class); serverboundPackets.register(0x1F, ServerboundRecipeBookSeenRecipePacket.class, ServerboundRecipeBookSeenRecipePacket::new);
serverboundPackets.accept(0x20, ServerboundRenameItemPacket.class); serverboundPackets.register(0x20, ServerboundRenameItemPacket.class, ServerboundRenameItemPacket::new);
serverboundPackets.accept(0x21, ServerboundResourcePackPacket.class); serverboundPackets.register(0x21, ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new);
serverboundPackets.accept(0x22, ServerboundSeenAdvancementsPacket.class); serverboundPackets.register(0x22, ServerboundSeenAdvancementsPacket.class, ServerboundSeenAdvancementsPacket::new);
serverboundPackets.accept(0x23, ServerboundSelectTradePacket.class); serverboundPackets.register(0x23, ServerboundSelectTradePacket.class, ServerboundSelectTradePacket::new);
serverboundPackets.accept(0x24, ServerboundSetBeaconPacket.class); serverboundPackets.register(0x24, ServerboundSetBeaconPacket.class, ServerboundSetBeaconPacket::new);
serverboundPackets.accept(0x25, ServerboundSetCarriedItemPacket.class); serverboundPackets.register(0x25, ServerboundSetCarriedItemPacket.class, ServerboundSetCarriedItemPacket::new);
serverboundPackets.accept(0x26, ServerboundSetCommandBlockPacket.class); serverboundPackets.register(0x26, ServerboundSetCommandBlockPacket.class, ServerboundSetCommandBlockPacket::new);
serverboundPackets.accept(0x27, ServerboundSetCommandMinecartPacket.class); serverboundPackets.register(0x27, ServerboundSetCommandMinecartPacket.class, ServerboundSetCommandMinecartPacket::new);
serverboundPackets.accept(0x28, ServerboundSetCreativeModeSlotPacket.class); serverboundPackets.register(0x28, ServerboundSetCreativeModeSlotPacket.class, ServerboundSetCreativeModeSlotPacket::new);
serverboundPackets.accept(0x29, ServerboundSetJigsawBlockPacket.class); serverboundPackets.register(0x29, ServerboundSetJigsawBlockPacket.class, ServerboundSetJigsawBlockPacket::new);
serverboundPackets.accept(0x2A, ServerboundSetStructureBlockPacket.class); serverboundPackets.register(0x2A, ServerboundSetStructureBlockPacket.class, ServerboundSetStructureBlockPacket::new);
serverboundPackets.accept(0x2B, ServerboundSignUpdatePacket.class); serverboundPackets.register(0x2B, ServerboundSignUpdatePacket.class, ServerboundSignUpdatePacket::new);
serverboundPackets.accept(0x2C, ServerboundSwingPacket.class); serverboundPackets.register(0x2C, ServerboundSwingPacket.class, ServerboundSwingPacket::new);
serverboundPackets.accept(0x2D, ServerboundTeleportToEntityPacket.class); serverboundPackets.register(0x2D, ServerboundTeleportToEntityPacket.class, ServerboundTeleportToEntityPacket::new);
serverboundPackets.accept(0x2E, ServerboundUseItemOnPacket.class); serverboundPackets.register(0x2E, ServerboundUseItemOnPacket.class, ServerboundUseItemOnPacket::new);
serverboundPackets.accept(0x2F, ServerboundUseItemPacket.class); serverboundPackets.register(0x2F, ServerboundUseItemPacket.class, ServerboundUseItemPacket::new);
} }
private void initStatus(BiConsumer<Integer, Class<? extends Packet>> clientboundPackets, BiConsumer<Integer, Class<? extends Packet>> serverboundPackets) { private void initStatus(PacketRegisterFactory clientboundPackets, PacketRegisterFactory serverboundPackets) {
clientboundPackets.accept(0x00, ClientboundStatusResponsePacket.class); clientboundPackets.register(0x01, ClientboundStatusResponsePacket.class, ClientboundStatusResponsePacket::new);
clientboundPackets.accept(0x01, ClientboundPongResponsePacket.class); clientboundPackets.register(0x00, ClientboundStatusResponsePacket.class, ClientboundStatusResponsePacket::new);
clientboundPackets.register(0x01, ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new);
serverboundPackets.accept(0x00, ServerboundStatusRequestPacket.class); serverboundPackets.register(0x00, ServerboundStatusRequestPacket.class, ServerboundStatusRequestPacket::new);
serverboundPackets.accept(0x01, ServerboundPingRequestPacket.class); serverboundPackets.register(0x01, ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new);
}
@FunctionalInterface
public interface PacketRegisterFactory {
<T extends Packet> void register(int id, Class<T> packetClass, PacketFactory<T> factory);
} }
} }