use more standard packet id names

This commit is contained in:
Tnze
2024-06-16 16:39:22 +08:00
parent 9e64fe59a1
commit de10351a91
4 changed files with 61 additions and 38 deletions

View File

@ -8,13 +8,13 @@ func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[ClientboundLoginDisconnect-0]
_ = x[ClientboundLoginEncryptionRequest-1]
_ = x[ClientboundLoginSuccess-2]
_ = x[ClientboundLoginCompression-3]
_ = x[ClientboundLoginPluginRequest-4]
_ = x[ClientboundLoginLoginDisconnect-0]
_ = x[ClientboundLoginHello-1]
_ = x[ClientboundLoginGameProfile-2]
_ = x[ClientboundLoginLoginCompression-3]
_ = x[ClientboundLoginCustomQuery-4]
_ = x[ClientboundLoginCookieRequest-5]
_ = x[ClientboundStatusResponse-0]
_ = x[ClientboundStatusStatusResponse-0]
_ = x[ClientboundStatusPongResponse-1]
_ = x[ClientboundConfigCookieRequest-0]
_ = x[ClientboundConfigCustomPayload-1]
@ -160,9 +160,9 @@ func _() {
_ = x[ClientboundPacketIDGuard-124]
}
const _ClientboundPacketID_name = "ClientboundLoginDisconnectClientboundLoginEncryptionRequestClientboundLoginSuccessClientboundLoginCompressionClientboundLoginPluginRequestClientboundLoginCookieRequestClientboundConfigResetChatClientboundConfigRegistryDataClientboundConfigResourcePackPopClientboundConfigResourcePackPushClientboundConfigStoreCookieClientboundConfigTransferClientboundConfigUpdateEnabledFeaturesClientboundConfigUpdateTagsClientboundConfigSelectKnownPacksClientboundConfigCustomReportDetailsClientboundConfigServerLinksClientboundCommandsClientboundContainerCloseClientboundContainerSetContentClientboundContainerSetDataClientboundContainerSetSlotClientboundCookieRequestClientboundCooldownClientboundCustomChatCompletionsClientboundCustomPayloadClientboundDamageEventClientboundDebugSampleClientboundDeleteChatClientboundDisconnectClientboundDisguisedChatClientboundEntityEventClientboundExplodeClientboundForgetLevelChunkClientboundGameEventClientboundHorseScreenOpenClientboundHurtAnimationClientboundInitializeBorderClientboundKeepAliveClientboundLevelChunkWithLightClientboundLevelEventClientboundLevelParticlesClientboundLightUpdateClientboundLoginClientboundMapItemDataClientboundMerchantOffersClientboundMoveEntityPosClientboundMoveEntityPosRotClientboundMoveEntityRotClientboundMoveVehicleClientboundOpenBookClientboundOpenScreenClientboundOpenSignEditorClientboundPingClientboundPongResponseClientboundPlaceGhostRecipeClientboundPlayerAbilitiesClientboundPlayerChatClientboundPlayerCombatEndClientboundPlayerCombatEnterClientboundPlayerCombatKillClientboundPlayerInfoRemoveClientboundPlayerInfoUpdateClientboundPlayerLookAtClientboundPlayerPositionClientboundRecipeClientboundRemoveEntitiesClientboundRemoveMobEffectClientboundResetScoreClientboundResourcePackPopClientboundResourcePackPushClientboundRespawnClientboundRotateHeadClientboundSectionBlocksUpdateClientboundSelectAdvancementsTabClientboundServerDataClientboundSetActionBarTextClientboundSetBorderCenterClientboundSetBorderLerpSizeClientboundSetBorderSizeClientboundSetBorderWarningDelayClientboundSetBorderWarningDistanceClientboundSetCameraClientboundSetCarriedItemClientboundSetChunkCacheCenterClientboundSetChunkCacheRadiusClientboundSetDefaultSpawnPositionClientboundSetDisplayObjectiveClientboundSetEntityDataClientboundSetEntityLinkClientboundSetEntityMotionClientboundSetEquipmentClientboundSetExperienceClientboundSetHealthClientboundSetObjectiveClientboundSetPassengersClientboundSetPlayerTeamClientboundSetScoreClientboundSetSimulationDistanceClientboundSetSubtitleTextClientboundSetTimeClientboundSetTitleTextClientboundSetTitlesAnimationClientboundSoundEntityClientboundSoundClientboundStartConfigurationClientboundStopSoundClientboundStoreCookieClientboundSystemChatClientboundTabListClientboundTagQueryClientboundTakeItemEntityClientboundTeleportEntityClientboundTickingStateClientboundTickingStepClientboundTransferClientboundUpdateAdvancementsClientboundUpdateAttributesClientboundUpdateMobEffectClientboundUpdateRecipesClientboundUpdateTagsClientboundProjectilePowerClientboundCustomReportDetailsClientboundServerLinksClientboundPacketIDGuard"
const _ClientboundPacketID_name = "ClientboundLoginLoginDisconnectClientboundLoginHelloClientboundLoginGameProfileClientboundLoginLoginCompressionClientboundLoginCustomQueryClientboundLoginCookieRequestClientboundConfigResetChatClientboundConfigRegistryDataClientboundConfigResourcePackPopClientboundConfigResourcePackPushClientboundConfigStoreCookieClientboundConfigTransferClientboundConfigUpdateEnabledFeaturesClientboundConfigUpdateTagsClientboundConfigSelectKnownPacksClientboundConfigCustomReportDetailsClientboundConfigServerLinksClientboundCommandsClientboundContainerCloseClientboundContainerSetContentClientboundContainerSetDataClientboundContainerSetSlotClientboundCookieRequestClientboundCooldownClientboundCustomChatCompletionsClientboundCustomPayloadClientboundDamageEventClientboundDebugSampleClientboundDeleteChatClientboundDisconnectClientboundDisguisedChatClientboundEntityEventClientboundExplodeClientboundForgetLevelChunkClientboundGameEventClientboundHorseScreenOpenClientboundHurtAnimationClientboundInitializeBorderClientboundKeepAliveClientboundLevelChunkWithLightClientboundLevelEventClientboundLevelParticlesClientboundLightUpdateClientboundLoginClientboundMapItemDataClientboundMerchantOffersClientboundMoveEntityPosClientboundMoveEntityPosRotClientboundMoveEntityRotClientboundMoveVehicleClientboundOpenBookClientboundOpenScreenClientboundOpenSignEditorClientboundPingClientboundPongResponseClientboundPlaceGhostRecipeClientboundPlayerAbilitiesClientboundPlayerChatClientboundPlayerCombatEndClientboundPlayerCombatEnterClientboundPlayerCombatKillClientboundPlayerInfoRemoveClientboundPlayerInfoUpdateClientboundPlayerLookAtClientboundPlayerPositionClientboundRecipeClientboundRemoveEntitiesClientboundRemoveMobEffectClientboundResetScoreClientboundResourcePackPopClientboundResourcePackPushClientboundRespawnClientboundRotateHeadClientboundSectionBlocksUpdateClientboundSelectAdvancementsTabClientboundServerDataClientboundSetActionBarTextClientboundSetBorderCenterClientboundSetBorderLerpSizeClientboundSetBorderSizeClientboundSetBorderWarningDelayClientboundSetBorderWarningDistanceClientboundSetCameraClientboundSetCarriedItemClientboundSetChunkCacheCenterClientboundSetChunkCacheRadiusClientboundSetDefaultSpawnPositionClientboundSetDisplayObjectiveClientboundSetEntityDataClientboundSetEntityLinkClientboundSetEntityMotionClientboundSetEquipmentClientboundSetExperienceClientboundSetHealthClientboundSetObjectiveClientboundSetPassengersClientboundSetPlayerTeamClientboundSetScoreClientboundSetSimulationDistanceClientboundSetSubtitleTextClientboundSetTimeClientboundSetTitleTextClientboundSetTitlesAnimationClientboundSoundEntityClientboundSoundClientboundStartConfigurationClientboundStopSoundClientboundStoreCookieClientboundSystemChatClientboundTabListClientboundTagQueryClientboundTakeItemEntityClientboundTeleportEntityClientboundTickingStateClientboundTickingStepClientboundTransferClientboundUpdateAdvancementsClientboundUpdateAttributesClientboundUpdateMobEffectClientboundUpdateRecipesClientboundUpdateTagsClientboundProjectilePowerClientboundCustomReportDetailsClientboundServerLinksClientboundPacketIDGuard"
var _ClientboundPacketID_index = [...]uint16{0, 26, 59, 82, 109, 138, 167, 193, 222, 254, 287, 315, 340, 378, 405, 438, 474, 502, 521, 546, 576, 603, 630, 654, 673, 705, 729, 751, 773, 794, 815, 839, 861, 879, 906, 926, 952, 976, 1003, 1023, 1053, 1074, 1099, 1121, 1137, 1159, 1184, 1208, 1235, 1259, 1281, 1300, 1321, 1346, 1361, 1384, 1411, 1437, 1458, 1484, 1512, 1539, 1566, 1593, 1616, 1641, 1658, 1683, 1709, 1730, 1756, 1783, 1801, 1822, 1852, 1884, 1905, 1932, 1958, 1986, 2010, 2042, 2077, 2097, 2122, 2152, 2182, 2216, 2246, 2270, 2294, 2320, 2343, 2367, 2387, 2410, 2434, 2458, 2477, 2509, 2535, 2553, 2576, 2605, 2627, 2643, 2672, 2692, 2714, 2735, 2753, 2772, 2797, 2822, 2845, 2867, 2886, 2915, 2942, 2968, 2992, 3013, 3039, 3069, 3091, 3115}
var _ClientboundPacketID_index = [...]uint16{0, 31, 52, 79, 111, 138, 167, 193, 222, 254, 287, 315, 340, 378, 405, 438, 474, 502, 521, 546, 576, 603, 630, 654, 673, 705, 729, 751, 773, 794, 815, 839, 861, 879, 906, 926, 952, 976, 1003, 1023, 1053, 1074, 1099, 1121, 1137, 1159, 1184, 1208, 1235, 1259, 1281, 1300, 1321, 1346, 1361, 1384, 1411, 1437, 1458, 1484, 1512, 1539, 1566, 1593, 1616, 1641, 1658, 1683, 1709, 1730, 1756, 1783, 1801, 1822, 1852, 1884, 1905, 1932, 1958, 1986, 2010, 2042, 2077, 2097, 2122, 2152, 2182, 2216, 2246, 2270, 2294, 2320, 2343, 2367, 2387, 2410, 2434, 2458, 2477, 2509, 2535, 2553, 2576, 2605, 2627, 2643, 2672, 2692, 2714, 2735, 2753, 2772, 2797, 2822, 2845, 2867, 2886, 2915, 2942, 2968, 2992, 3013, 3039, 3069, 3091, 3115}
func (i ClientboundPacketID) String() string {
if i < 0 || i >= ClientboundPacketID(len(_ClientboundPacketID_index)-1) {

View File

@ -3,29 +3,52 @@ package packetid
// This file might be remove in the future go-mc!!!
// Login Clientbound
//
// Deprecated: Legacy name, might be removed in future version
const (
LoginDisconnect = iota
LoginEncryptionRequest
LoginSuccess
LoginCompression
LoginPluginRequest
LoginDisconnect = ClientboundLoginLoginDisconnect
LoginEncryptionRequest = ClientboundLoginHello
LoginSuccess = ClientboundLoginGameProfile
LoginCompression = ClientboundLoginLoginCompression
LoginPluginRequest = ClientboundLoginCustomQuery
ClientboundLoginDisconnect = ClientboundLoginLoginDisconnect
ClientboundLoginEncryptionRequest = ClientboundLoginHello
ClientboundLoginSuccess = ClientboundLoginGameProfile
ClientboundLoginCompression = ClientboundLoginLoginCompression
ClientboundLoginPluginRequest = ClientboundLoginCustomQuery
)
// Login Serverbound
//
// Deprecated: Legacy name, might be removed in future version
const (
LoginStart = iota
LoginEncryptionResponse
LoginPluginResponse
LoginStart = ServerboundLoginHello
LoginEncryptionResponse = ServerboundLoginKey
LoginPluginResponse = ServerboundLoginCustomQueryAnswer
ServerboundLoginStart = ServerboundLoginHello
ServerboundLoginEncryptionResponse = ServerboundLoginKey
ServerboundLoginPluginResponse = ServerboundLoginCustomQueryAnswer
ServerboundLoginAcknowledged = ServerboundLoginLoginAcknowledged
)
// Status Clientbound
//
// Deprecated: Legacy name, might be removed in future version
const (
StatusResponse = iota
StatusPongResponse
StatusResponse = ClientboundStatusStatusResponse
StatusPongResponse = ClientboundStatusPongResponse
ClientboundStatusResponse = ClientboundStatusStatusResponse
)
// Status Serverbound
//
// Deprecated: Legacy name, might be removed in future version
const (
StatusRequest = iota
StatusPingRequest
StatusRequest = ServerboundStatusStatusRequest
StatusPingRequest = ServerboundStatusPingRequest
ServerboundStatusRequest = ServerboundStatusStatusRequest
)

View File

@ -9,32 +9,32 @@ type (
// Login Clientbound
const (
ClientboundLoginDisconnect ClientboundPacketID = iota // LoginDisconnect
ClientboundLoginEncryptionRequest // Hello
ClientboundLoginSuccess // GameProfile
ClientboundLoginCompression // LoginCompression
ClientboundLoginPluginRequest // CustomQuery
ClientboundLoginLoginDisconnect ClientboundPacketID = iota
ClientboundLoginHello
ClientboundLoginGameProfile
ClientboundLoginLoginCompression
ClientboundLoginCustomQuery
ClientboundLoginCookieRequest
)
// Login Serverbound
const (
ServerboundLoginStart ServerboundPacketID = iota // Hello
ServerboundLoginEncryptionResponse // Key
ServerboundLoginPluginResponse // CustomQueryAnswer
ServerboundLoginAcknowledged // LoginAcknowledged
ServerboundLoginHello ServerboundPacketID = iota
ServerboundLoginKey
ServerboundLoginCustomQueryAnswer
ServerboundLoginLoginAcknowledged
ServerboundLoginCookieResponse
)
// Status Clientbound
const (
ClientboundStatusResponse ClientboundPacketID = iota
ClientboundStatusStatusResponse ClientboundPacketID = iota
ClientboundStatusPongResponse
)
// Status Serverbound
const (
ServerboundStatusRequest ServerboundPacketID = iota
ServerboundStatusStatusRequest ServerboundPacketID = iota
ServerboundStatusPingRequest
)

View File

@ -8,12 +8,12 @@ func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[ServerboundLoginStart-0]
_ = x[ServerboundLoginEncryptionResponse-1]
_ = x[ServerboundLoginPluginResponse-2]
_ = x[ServerboundLoginAcknowledged-3]
_ = x[ServerboundLoginHello-0]
_ = x[ServerboundLoginKey-1]
_ = x[ServerboundLoginCustomQueryAnswer-2]
_ = x[ServerboundLoginLoginAcknowledged-3]
_ = x[ServerboundLoginCookieResponse-4]
_ = x[ServerboundStatusRequest-0]
_ = x[ServerboundStatusStatusRequest-0]
_ = x[ServerboundStatusPingRequest-1]
_ = x[ServerboundConfigClientInformation-0]
_ = x[ServerboundConfigCookieResponse-1]
@ -84,9 +84,9 @@ func _() {
_ = x[ServerboundPacketIDGuard-58]
}
const _ServerboundPacketID_name = "ServerboundLoginStartServerboundLoginEncryptionResponseServerboundLoginPluginResponseServerboundLoginAcknowledgedServerboundLoginCookieResponseServerboundConfigPongServerboundConfigResourcePackServerboundConfigSelectKnownPacksServerboundChunkBatchReceivedServerboundClientCommandServerboundClientInformationServerboundCommandSuggestionServerboundConfigurationAcknowledgedServerboundContainerButtonClickServerboundContainerClickServerboundContainerCloseServerboundContainerSlotStateChangedServerboundCookieResponseServerboundCustomPayloadServerboundDebugSampleSubscriptionServerboundEditBookServerboundEntityTagQueryServerboundInteractServerboundJigsawGenerateServerboundKeepAliveServerboundLockDifficultyServerboundMovePlayerPosServerboundMovePlayerPosRotServerboundMovePlayerRotServerboundMovePlayerStatusOnlyServerboundMoveVehicleServerboundPaddleBoatServerboundPickItemServerboundPingRequestServerboundPlaceRecipeServerboundPlayerAbilitiesServerboundPlayerActionServerboundPlayerCommandServerboundPlayerInputServerboundPongServerboundRecipeBookChangeSettingsServerboundRecipeBookSeenRecipeServerboundRenameItemServerboundResourcePackServerboundSeenAdvancementsServerboundSelectTradeServerboundSetBeaconServerboundSetCarriedItemServerboundSetCommandBlockServerboundSetCommandMinecartServerboundSetCreativeModeSlotServerboundSetJigsawBlockServerboundSetStructureBlockServerboundSignUpdateServerboundSwingServerboundTeleportToEntityServerboundUseItemOnServerboundUseItemServerboundPacketIDGuard"
const _ServerboundPacketID_name = "ServerboundLoginHelloServerboundLoginKeyServerboundLoginCustomQueryAnswerServerboundLoginLoginAcknowledgedServerboundLoginCookieResponseServerboundConfigPongServerboundConfigResourcePackServerboundConfigSelectKnownPacksServerboundChunkBatchReceivedServerboundClientCommandServerboundClientInformationServerboundCommandSuggestionServerboundConfigurationAcknowledgedServerboundContainerButtonClickServerboundContainerClickServerboundContainerCloseServerboundContainerSlotStateChangedServerboundCookieResponseServerboundCustomPayloadServerboundDebugSampleSubscriptionServerboundEditBookServerboundEntityTagQueryServerboundInteractServerboundJigsawGenerateServerboundKeepAliveServerboundLockDifficultyServerboundMovePlayerPosServerboundMovePlayerPosRotServerboundMovePlayerRotServerboundMovePlayerStatusOnlyServerboundMoveVehicleServerboundPaddleBoatServerboundPickItemServerboundPingRequestServerboundPlaceRecipeServerboundPlayerAbilitiesServerboundPlayerActionServerboundPlayerCommandServerboundPlayerInputServerboundPongServerboundRecipeBookChangeSettingsServerboundRecipeBookSeenRecipeServerboundRenameItemServerboundResourcePackServerboundSeenAdvancementsServerboundSelectTradeServerboundSetBeaconServerboundSetCarriedItemServerboundSetCommandBlockServerboundSetCommandMinecartServerboundSetCreativeModeSlotServerboundSetJigsawBlockServerboundSetStructureBlockServerboundSignUpdateServerboundSwingServerboundTeleportToEntityServerboundUseItemOnServerboundUseItemServerboundPacketIDGuard"
var _ServerboundPacketID_index = [...]uint16{0, 21, 55, 85, 113, 143, 164, 193, 226, 255, 279, 307, 335, 371, 402, 427, 452, 488, 513, 537, 571, 590, 615, 634, 659, 679, 704, 728, 755, 779, 810, 832, 853, 872, 894, 916, 942, 965, 989, 1011, 1026, 1061, 1092, 1113, 1136, 1163, 1185, 1205, 1230, 1256, 1285, 1315, 1340, 1368, 1389, 1405, 1432, 1452, 1470, 1494}
var _ServerboundPacketID_index = [...]uint16{0, 21, 40, 73, 106, 136, 157, 186, 219, 248, 272, 300, 328, 364, 395, 420, 445, 481, 506, 530, 564, 583, 608, 627, 652, 672, 697, 721, 748, 772, 803, 825, 846, 865, 887, 909, 935, 958, 982, 1004, 1019, 1054, 1085, 1106, 1129, 1156, 1178, 1198, 1223, 1249, 1278, 1308, 1333, 1361, 1382, 1398, 1425, 1445, 1463, 1487}
func (i ServerboundPacketID) String() string {
if i < 0 || i >= ServerboundPacketID(len(_ServerboundPacketID_index)-1) {