From fff914a786b886f1ae738dcaa754e52ec6fc2be3 Mon Sep 17 00:00:00 2001 From: Tnze Date: Sat, 15 Jun 2024 17:36:13 +0800 Subject: [PATCH] update packetid to 1.21 fix compile issue --- bot/configuration.go | 3 +- data/packetid/clientboundpacketid_string.go | 230 +++++++++++--------- data/packetid/generator/GenPacketId.java | 51 +++++ data/packetid/generator/Main.java | 53 ----- data/packetid/packetid.go | 27 ++- data/packetid/serverboundpacketid_string.go | 121 +++++----- 6 files changed, 265 insertions(+), 220 deletions(-) create mode 100644 data/packetid/generator/GenPacketId.java delete mode 100644 data/packetid/generator/Main.java diff --git a/bot/configuration.go b/bot/configuration.go index 84c1a4e..4d39331 100644 --- a/bot/configuration.go +++ b/bot/configuration.go @@ -105,7 +105,8 @@ func (c *Client) joinConfiguration(conn *net.Conn) error { return ConfigErr{"registry data", err} } - case packetid.ClientboundConfigResourcePack: + case packetid.ClientboundConfigResourcePackPop: // TODO + case packetid.ClientboundConfigResourcePackPush: var Url, Hash pk.String var Forced pk.Boolean var PromptMessage pk.Option[chat.Message, *chat.Message] diff --git a/data/packetid/clientboundpacketid_string.go b/data/packetid/clientboundpacketid_string.go index c2762a6..fe10a7e 100644 --- a/data/packetid/clientboundpacketid_string.go +++ b/data/packetid/clientboundpacketid_string.go @@ -13,17 +13,26 @@ func _() { _ = x[ClientboundLoginSuccess-2] _ = x[ClientboundLoginCompression-3] _ = x[ClientboundLoginPluginRequest-4] + _ = x[ClientboundLoginCookieRequest-5] _ = x[ClientboundStatusResponse-0] _ = x[ClientboundStatusPongResponse-1] - _ = x[ClientboundConfigCustomPayload-0] - _ = x[ClientboundConfigDisconnect-1] - _ = x[ClientboundConfigFinishConfiguration-2] - _ = x[ClientboundConfigKeepAlive-3] - _ = x[ClientboundConfigPing-4] - _ = x[ClientboundConfigRegistryData-5] - _ = x[ClientboundConfigResourcePack-6] - _ = x[ClientboundConfigUpdateEnabledFeatures-7] - _ = x[ClientboundConfigUpdateTags-8] + _ = x[ClientboundConfigCookieRequest-0] + _ = x[ClientboundConfigCustomPayload-1] + _ = x[ClientboundConfigDisconnect-2] + _ = x[ClientboundConfigFinishConfiguration-3] + _ = x[ClientboundConfigKeepAlive-4] + _ = x[ClientboundConfigPing-5] + _ = x[ClientboundConfigResetChat-6] + _ = x[ClientboundConfigRegistryData-7] + _ = x[ClientboundConfigResourcePackPop-8] + _ = x[ClientboundConfigResourcePackPush-9] + _ = x[ClientboundConfigStoreCookie-10] + _ = x[ClientboundConfigTransfer-11] + _ = x[ClientboundConfigUpdateEnabledFeatures-12] + _ = x[ClientboundConfigUpdateTags-13] + _ = x[ClientboundConfigSelectKnownPacks-14] + _ = x[ClientboundConfigCustomReportDetails-15] + _ = x[ClientboundConfigServerLinks-16] _ = x[BundleDelimiter-0] _ = x[ClientboundAddEntity-1] _ = x[ClientboundAddExperienceOrb-2] @@ -46,107 +55,114 @@ func _() { _ = x[ClientboundContainerSetContent-19] _ = x[ClientboundContainerSetData-20] _ = x[ClientboundContainerSetSlot-21] - _ = x[ClientboundCooldown-22] - _ = x[ClientboundCustomChatCompletions-23] - _ = x[ClientboundCustomPayload-24] - _ = x[ClientboundDamageEvent-25] - _ = x[ClientboundDeleteChat-26] - _ = x[ClientboundDisconnect-27] - _ = x[ClientboundDisguisedChat-28] - _ = x[ClientboundEntityEvent-29] - _ = x[ClientboundExplode-30] - _ = x[ClientboundForgetLevelChunk-31] - _ = x[ClientboundGameEvent-32] - _ = x[ClientboundHorseScreenOpen-33] - _ = x[ClientboundHurtAnimation-34] - _ = x[ClientboundInitializeBorder-35] - _ = x[ClientboundKeepAlive-36] - _ = x[ClientboundLevelChunkWithLight-37] - _ = x[ClientboundLevelEvent-38] - _ = x[ClientboundLevelParticles-39] - _ = x[ClientboundLightUpdate-40] - _ = x[ClientboundLogin-41] - _ = x[ClientboundMapItemData-42] - _ = x[ClientboundMerchantOffers-43] - _ = x[ClientboundMoveEntityPos-44] - _ = x[ClientboundMoveEntityPosRot-45] - _ = x[ClientboundMoveEntityRot-46] - _ = x[ClientboundMoveVehicle-47] - _ = x[ClientboundOpenBook-48] - _ = x[ClientboundOpenScreen-49] - _ = x[ClientboundOpenSignEditor-50] - _ = x[ClientboundPing-51] - _ = x[ClientboundPongResponse-52] - _ = x[ClientboundPlaceGhostRecipe-53] - _ = x[ClientboundPlayerAbilities-54] - _ = x[ClientboundPlayerChat-55] - _ = x[ClientboundPlayerCombatEnd-56] - _ = x[ClientboundPlayerCombatEnter-57] - _ = x[ClientboundPlayerCombatKill-58] - _ = x[ClientboundPlayerInfoRemove-59] - _ = x[ClientboundPlayerInfoUpdate-60] - _ = x[ClientboundPlayerLookAt-61] - _ = x[ClientboundPlayerPosition-62] - _ = x[ClientboundRecipe-63] - _ = x[ClientboundRemoveEntities-64] - _ = x[ClientboundRemoveMobEffect-65] - _ = x[ClientboundResetScore-66] - _ = x[ClientboundResourcePackPop-67] - _ = x[ClientboundResourcePackPush-68] - _ = x[ClientboundRespawn-69] - _ = x[ClientboundRotateHead-70] - _ = x[ClientboundSectionBlocksUpdate-71] - _ = x[ClientboundSelectAdvancementsTab-72] - _ = x[ClientboundServerData-73] - _ = x[ClientboundSetActionBarText-74] - _ = x[ClientboundSetBorderCenter-75] - _ = x[ClientboundSetBorderLerpSize-76] - _ = x[ClientboundSetBorderSize-77] - _ = x[ClientboundSetBorderWarningDelay-78] - _ = x[ClientboundSetBorderWarningDistance-79] - _ = x[ClientboundSetCamera-80] - _ = x[ClientboundSetCarriedItem-81] - _ = x[ClientboundSetChunkCacheCenter-82] - _ = x[ClientboundSetChunkCacheRadius-83] - _ = x[ClientboundSetDefaultSpawnPosition-84] - _ = x[ClientboundSetDisplayObjective-85] - _ = x[ClientboundSetEntityData-86] - _ = x[ClientboundSetEntityLink-87] - _ = x[ClientboundSetEntityMotion-88] - _ = x[ClientboundSetEquipment-89] - _ = x[ClientboundSetExperience-90] - _ = x[ClientboundSetHealth-91] - _ = x[ClientboundSetObjective-92] - _ = x[ClientboundSetPassengers-93] - _ = x[ClientboundSetPlayerTeam-94] - _ = x[ClientboundSetScore-95] - _ = x[ClientboundSetSimulationDistance-96] - _ = x[ClientboundSetSubtitleText-97] - _ = x[ClientboundSetTime-98] - _ = x[ClientboundSetTitleText-99] - _ = x[ClientboundSetTitlesAnimation-100] - _ = x[ClientboundSoundEntity-101] - _ = x[ClientboundSound-102] - _ = x[ClientboundStartConfiguration-103] - _ = x[ClientboundStopSound-104] - _ = x[ClientboundSystemChat-105] - _ = x[ClientboundTabList-106] - _ = x[ClientboundTagQuery-107] - _ = x[ClientboundTakeItemEntity-108] - _ = x[ClientboundTeleportEntity-109] - _ = x[ClientboundTickingState-110] - _ = x[ClientboundTickingStep-111] - _ = x[ClientboundUpdateAdvancements-112] - _ = x[ClientboundUpdateAttributes-113] - _ = x[ClientboundUpdateMobEffect-114] - _ = x[ClientboundUpdateRecipes-115] - _ = x[ClientboundUpdateTags-116] - _ = x[ClientboundPacketIDGuard-117] + _ = x[ClientboundCookieRequest-22] + _ = x[ClientboundCooldown-23] + _ = x[ClientboundCustomChatCompletions-24] + _ = x[ClientboundCustomPayload-25] + _ = x[ClientboundDamageEvent-26] + _ = x[ClientboundDebugSample-27] + _ = x[ClientboundDeleteChat-28] + _ = x[ClientboundDisconnect-29] + _ = x[ClientboundDisguisedChat-30] + _ = x[ClientboundEntityEvent-31] + _ = x[ClientboundExplode-32] + _ = x[ClientboundForgetLevelChunk-33] + _ = x[ClientboundGameEvent-34] + _ = x[ClientboundHorseScreenOpen-35] + _ = x[ClientboundHurtAnimation-36] + _ = x[ClientboundInitializeBorder-37] + _ = x[ClientboundKeepAlive-38] + _ = x[ClientboundLevelChunkWithLight-39] + _ = x[ClientboundLevelEvent-40] + _ = x[ClientboundLevelParticles-41] + _ = x[ClientboundLightUpdate-42] + _ = x[ClientboundLogin-43] + _ = x[ClientboundMapItemData-44] + _ = x[ClientboundMerchantOffers-45] + _ = x[ClientboundMoveEntityPos-46] + _ = x[ClientboundMoveEntityPosRot-47] + _ = x[ClientboundMoveEntityRot-48] + _ = x[ClientboundMoveVehicle-49] + _ = x[ClientboundOpenBook-50] + _ = x[ClientboundOpenScreen-51] + _ = x[ClientboundOpenSignEditor-52] + _ = x[ClientboundPing-53] + _ = x[ClientboundPongResponse-54] + _ = x[ClientboundPlaceGhostRecipe-55] + _ = x[ClientboundPlayerAbilities-56] + _ = x[ClientboundPlayerChat-57] + _ = x[ClientboundPlayerCombatEnd-58] + _ = x[ClientboundPlayerCombatEnter-59] + _ = x[ClientboundPlayerCombatKill-60] + _ = x[ClientboundPlayerInfoRemove-61] + _ = x[ClientboundPlayerInfoUpdate-62] + _ = x[ClientboundPlayerLookAt-63] + _ = x[ClientboundPlayerPosition-64] + _ = x[ClientboundRecipe-65] + _ = x[ClientboundRemoveEntities-66] + _ = x[ClientboundRemoveMobEffect-67] + _ = x[ClientboundResetScore-68] + _ = x[ClientboundResourcePackPop-69] + _ = x[ClientboundResourcePackPush-70] + _ = x[ClientboundRespawn-71] + _ = x[ClientboundRotateHead-72] + _ = x[ClientboundSectionBlocksUpdate-73] + _ = x[ClientboundSelectAdvancementsTab-74] + _ = x[ClientboundServerData-75] + _ = x[ClientboundSetActionBarText-76] + _ = x[ClientboundSetBorderCenter-77] + _ = x[ClientboundSetBorderLerpSize-78] + _ = x[ClientboundSetBorderSize-79] + _ = x[ClientboundSetBorderWarningDelay-80] + _ = x[ClientboundSetBorderWarningDistance-81] + _ = x[ClientboundSetCamera-82] + _ = x[ClientboundSetCarriedItem-83] + _ = x[ClientboundSetChunkCacheCenter-84] + _ = x[ClientboundSetChunkCacheRadius-85] + _ = x[ClientboundSetDefaultSpawnPosition-86] + _ = x[ClientboundSetDisplayObjective-87] + _ = x[ClientboundSetEntityData-88] + _ = x[ClientboundSetEntityLink-89] + _ = x[ClientboundSetEntityMotion-90] + _ = x[ClientboundSetEquipment-91] + _ = x[ClientboundSetExperience-92] + _ = x[ClientboundSetHealth-93] + _ = x[ClientboundSetObjective-94] + _ = x[ClientboundSetPassengers-95] + _ = x[ClientboundSetPlayerTeam-96] + _ = x[ClientboundSetScore-97] + _ = x[ClientboundSetSimulationDistance-98] + _ = x[ClientboundSetSubtitleText-99] + _ = x[ClientboundSetTime-100] + _ = x[ClientboundSetTitleText-101] + _ = x[ClientboundSetTitlesAnimation-102] + _ = x[ClientboundSoundEntity-103] + _ = x[ClientboundSound-104] + _ = x[ClientboundStartConfiguration-105] + _ = x[ClientboundStopSound-106] + _ = x[ClientboundStoreCookie-107] + _ = x[ClientboundSystemChat-108] + _ = x[ClientboundTabList-109] + _ = x[ClientboundTagQuery-110] + _ = x[ClientboundTakeItemEntity-111] + _ = x[ClientboundTeleportEntity-112] + _ = x[ClientboundTickingState-113] + _ = x[ClientboundTickingStep-114] + _ = x[ClientboundTransfer-115] + _ = x[ClientboundUpdateAdvancements-116] + _ = x[ClientboundUpdateAttributes-117] + _ = x[ClientboundUpdateMobEffect-118] + _ = x[ClientboundUpdateRecipes-119] + _ = x[ClientboundUpdateTags-120] + _ = x[ClientboundProjectilePower-121] + _ = x[ClientboundCustomReportDetails-122] + _ = x[ClientboundServerLinks-123] + _ = x[ClientboundPacketIDGuard-124] } -const _ClientboundPacketID_name = "ClientboundLoginDisconnectClientboundLoginEncryptionRequestClientboundLoginSuccessClientboundLoginCompressionClientboundLoginPluginRequestClientboundConfigRegistryDataClientboundConfigResourcePackClientboundConfigUpdateEnabledFeaturesClientboundConfigUpdateTagsClientboundBlockUpdateClientboundBossEventClientboundChangeDifficultyClientboundChunkBatchFinishedClientboundChunkBatchStartClientboundChunksBiomesClientboundClearTitlesClientboundCommandSuggestionsClientboundCommandsClientboundContainerCloseClientboundContainerSetContentClientboundContainerSetDataClientboundContainerSetSlotClientboundCooldownClientboundCustomChatCompletionsClientboundCustomPayloadClientboundDamageEventClientboundDeleteChatClientboundDisconnectClientboundDisguisedChatClientboundEntityEventClientboundExplodeClientboundForgetLevelChunkClientboundGameEventClientboundHorseScreenOpenClientboundHurtAnimationClientboundInitializeBorderClientboundKeepAliveClientboundLevelChunkWithLightClientboundLevelEventClientboundLevelParticlesClientboundLightUpdateClientboundLoginClientboundMapItemDataClientboundMerchantOffersClientboundMoveEntityPosClientboundMoveEntityPosRotClientboundMoveEntityRotClientboundMoveVehicleClientboundOpenBookClientboundOpenScreenClientboundOpenSignEditorClientboundPingClientboundPongResponseClientboundPlaceGhostRecipeClientboundPlayerAbilitiesClientboundPlayerChatClientboundPlayerCombatEndClientboundPlayerCombatEnterClientboundPlayerCombatKillClientboundPlayerInfoRemoveClientboundPlayerInfoUpdateClientboundPlayerLookAtClientboundPlayerPositionClientboundRecipeClientboundRemoveEntitiesClientboundRemoveMobEffectClientboundResetScoreClientboundResourcePackPopClientboundResourcePackPushClientboundRespawnClientboundRotateHeadClientboundSectionBlocksUpdateClientboundSelectAdvancementsTabClientboundServerDataClientboundSetActionBarTextClientboundSetBorderCenterClientboundSetBorderLerpSizeClientboundSetBorderSizeClientboundSetBorderWarningDelayClientboundSetBorderWarningDistanceClientboundSetCameraClientboundSetCarriedItemClientboundSetChunkCacheCenterClientboundSetChunkCacheRadiusClientboundSetDefaultSpawnPositionClientboundSetDisplayObjectiveClientboundSetEntityDataClientboundSetEntityLinkClientboundSetEntityMotionClientboundSetEquipmentClientboundSetExperienceClientboundSetHealthClientboundSetObjectiveClientboundSetPassengersClientboundSetPlayerTeamClientboundSetScoreClientboundSetSimulationDistanceClientboundSetSubtitleTextClientboundSetTimeClientboundSetTitleTextClientboundSetTitlesAnimationClientboundSoundEntityClientboundSoundClientboundStartConfigurationClientboundStopSoundClientboundSystemChatClientboundTabListClientboundTagQueryClientboundTakeItemEntityClientboundTeleportEntityClientboundTickingStateClientboundTickingStepClientboundUpdateAdvancementsClientboundUpdateAttributesClientboundUpdateMobEffectClientboundUpdateRecipesClientboundUpdateTagsClientboundPacketIDGuard" +const _ClientboundPacketID_name = "ClientboundLoginDisconnectClientboundLoginEncryptionRequestClientboundLoginSuccessClientboundLoginCompressionClientboundLoginPluginRequestClientboundLoginCookieRequestClientboundConfigResetChatClientboundConfigRegistryDataClientboundConfigResourcePackPopClientboundConfigResourcePackPushClientboundConfigStoreCookieClientboundConfigTransferClientboundConfigUpdateEnabledFeaturesClientboundConfigUpdateTagsClientboundConfigSelectKnownPacksClientboundConfigCustomReportDetailsClientboundConfigServerLinksClientboundCommandsClientboundContainerCloseClientboundContainerSetContentClientboundContainerSetDataClientboundContainerSetSlotClientboundCookieRequestClientboundCooldownClientboundCustomChatCompletionsClientboundCustomPayloadClientboundDamageEventClientboundDebugSampleClientboundDeleteChatClientboundDisconnectClientboundDisguisedChatClientboundEntityEventClientboundExplodeClientboundForgetLevelChunkClientboundGameEventClientboundHorseScreenOpenClientboundHurtAnimationClientboundInitializeBorderClientboundKeepAliveClientboundLevelChunkWithLightClientboundLevelEventClientboundLevelParticlesClientboundLightUpdateClientboundLoginClientboundMapItemDataClientboundMerchantOffersClientboundMoveEntityPosClientboundMoveEntityPosRotClientboundMoveEntityRotClientboundMoveVehicleClientboundOpenBookClientboundOpenScreenClientboundOpenSignEditorClientboundPingClientboundPongResponseClientboundPlaceGhostRecipeClientboundPlayerAbilitiesClientboundPlayerChatClientboundPlayerCombatEndClientboundPlayerCombatEnterClientboundPlayerCombatKillClientboundPlayerInfoRemoveClientboundPlayerInfoUpdateClientboundPlayerLookAtClientboundPlayerPositionClientboundRecipeClientboundRemoveEntitiesClientboundRemoveMobEffectClientboundResetScoreClientboundResourcePackPopClientboundResourcePackPushClientboundRespawnClientboundRotateHeadClientboundSectionBlocksUpdateClientboundSelectAdvancementsTabClientboundServerDataClientboundSetActionBarTextClientboundSetBorderCenterClientboundSetBorderLerpSizeClientboundSetBorderSizeClientboundSetBorderWarningDelayClientboundSetBorderWarningDistanceClientboundSetCameraClientboundSetCarriedItemClientboundSetChunkCacheCenterClientboundSetChunkCacheRadiusClientboundSetDefaultSpawnPositionClientboundSetDisplayObjectiveClientboundSetEntityDataClientboundSetEntityLinkClientboundSetEntityMotionClientboundSetEquipmentClientboundSetExperienceClientboundSetHealthClientboundSetObjectiveClientboundSetPassengersClientboundSetPlayerTeamClientboundSetScoreClientboundSetSimulationDistanceClientboundSetSubtitleTextClientboundSetTimeClientboundSetTitleTextClientboundSetTitlesAnimationClientboundSoundEntityClientboundSoundClientboundStartConfigurationClientboundStopSoundClientboundStoreCookieClientboundSystemChatClientboundTabListClientboundTagQueryClientboundTakeItemEntityClientboundTeleportEntityClientboundTickingStateClientboundTickingStepClientboundTransferClientboundUpdateAdvancementsClientboundUpdateAttributesClientboundUpdateMobEffectClientboundUpdateRecipesClientboundUpdateTagsClientboundProjectilePowerClientboundCustomReportDetailsClientboundServerLinksClientboundPacketIDGuard" -var _ClientboundPacketID_index = [...]uint16{0, 26, 59, 82, 109, 138, 167, 196, 234, 261, 283, 303, 330, 359, 385, 408, 430, 459, 478, 503, 533, 560, 587, 606, 638, 662, 684, 705, 726, 750, 772, 790, 817, 837, 863, 887, 914, 934, 964, 985, 1010, 1032, 1048, 1070, 1095, 1119, 1146, 1170, 1192, 1211, 1232, 1257, 1272, 1295, 1322, 1348, 1369, 1395, 1423, 1450, 1477, 1504, 1527, 1552, 1569, 1594, 1620, 1641, 1667, 1694, 1712, 1733, 1763, 1795, 1816, 1843, 1869, 1897, 1921, 1953, 1988, 2008, 2033, 2063, 2093, 2127, 2157, 2181, 2205, 2231, 2254, 2278, 2298, 2321, 2345, 2369, 2388, 2420, 2446, 2464, 2487, 2516, 2538, 2554, 2583, 2603, 2624, 2642, 2661, 2686, 2711, 2734, 2756, 2785, 2812, 2838, 2862, 2883, 2907} +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} func (i ClientboundPacketID) String() string { if i < 0 || i >= ClientboundPacketID(len(_ClientboundPacketID_index)-1) { diff --git a/data/packetid/generator/GenPacketId.java b/data/packetid/generator/GenPacketId.java new file mode 100644 index 0000000..87bfeda --- /dev/null +++ b/data/packetid/generator/GenPacketId.java @@ -0,0 +1,51 @@ +package pers.tnze.gomc.gen; + +import net.minecraft.SharedConstants; +import net.minecraft.network.ProtocolInfo; +import net.minecraft.network.protocol.configuration.ConfigurationProtocols; +import net.minecraft.network.protocol.game.GameProtocols; +import net.minecraft.network.protocol.login.LoginProtocols; +import net.minecraft.network.protocol.status.StatusProtocols; +import net.minecraft.server.Bootstrap; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; + +public class GenPacketId { + + public static void main(String[] args) throws Exception { + SharedConstants.tryDetectVersion(); + Bootstrap.bootStrap(); + try (FileWriter w = new FileWriter("packet_names.txt")) { + handlePackets(w, LoginProtocols.CLIENTBOUND_TEMPLATE, "ClientboundLogin"); + handlePackets(w, LoginProtocols.SERVERBOUND_TEMPLATE, "ServerboundLogin"); + handlePackets(w, StatusProtocols.CLIENTBOUND_TEMPLATE, "ClientboundStatus"); + handlePackets(w, StatusProtocols.SERVERBOUND_TEMPLATE, "ServerboundStatus"); + handlePackets(w, ConfigurationProtocols.CLIENTBOUND_TEMPLATE, "ClientboundConfig"); + handlePackets(w, ConfigurationProtocols.SERVERBOUND_TEMPLATE, "ServerboundConfig"); + handlePackets(w, GameProtocols.CLIENTBOUND_TEMPLATE, ""); + handlePackets(w, GameProtocols.SERVERBOUND_TEMPLATE, ""); + } + } + + private static void handlePackets(Writer w, ProtocolInfo.Unbound packets, String prefix) throws IOException { + packets.listPackets((packetType, i) -> { + String packetName = packetType.id().getPath(); + String[] words = packetName.split("_"); + try { + if (prefix != null) { + w.write(prefix); + } + for (String word : words) { + w.write(Character.toUpperCase(word.charAt(0))); + w.write(word.substring(1)); + } + w.write("\n"); + } catch (IOException e) { + throw new RuntimeException(e); + } + }); + w.write('\n'); + } +} \ No newline at end of file diff --git a/data/packetid/generator/Main.java b/data/packetid/generator/Main.java deleted file mode 100644 index 2bff17b..0000000 --- a/data/packetid/generator/Main.java +++ /dev/null @@ -1,53 +0,0 @@ -package pers.tnze.gomc.gen; - -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import net.minecraft.network.ConnectionProtocol; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.PacketFlow; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; - -public class Main { - - public static void main(String[] args) throws Exception { - try (FileWriter w = new FileWriter("packet_names.txt")) { - handlePackets(w, ConnectionProtocol.LOGIN.getPacketsByIds(PacketFlow.CLIENTBOUND)); - System.out.println(); - handlePackets(w, ConnectionProtocol.LOGIN.getPacketsByIds(PacketFlow.SERVERBOUND)); - System.out.println(); - System.out.println(); - handlePackets(w, ConnectionProtocol.STATUS.getPacketsByIds(PacketFlow.CLIENTBOUND)); - System.out.println(); - handlePackets(w, ConnectionProtocol.STATUS.getPacketsByIds(PacketFlow.SERVERBOUND)); - System.out.println(); - System.out.println(); - handlePackets(w, ConnectionProtocol.CONFIGURATION.getPacketsByIds(PacketFlow.CLIENTBOUND)); - System.out.println(); - handlePackets(w, ConnectionProtocol.CONFIGURATION.getPacketsByIds(PacketFlow.SERVERBOUND)); - System.out.println(); - System.out.println(); - handlePackets(w, ConnectionProtocol.PLAY.getPacketsByIds(PacketFlow.CLIENTBOUND)); - System.out.println(); - handlePackets(w, ConnectionProtocol.PLAY.getPacketsByIds(PacketFlow.SERVERBOUND)); - } - } - - private static void handlePackets(Writer w, Int2ObjectMap>> packets) throws IOException { - for (int i = 0; i < packets.size(); i++) { - Class> c = packets.get(i); - String className = c.getSimpleName(); - if (className.endsWith("Packet")) - className = className.substring(0, className.length() - "Packet".length()); - else { - String superClassName = c.getSuperclass().getSimpleName(); - if (superClassName.endsWith("Packet")) - className = superClassName.substring(0, superClassName.length() - "Packet".length()) + className; - } - System.out.println(className); - w.write(className + "\n"); - } - w.write('\n'); - } -} \ No newline at end of file diff --git a/data/packetid/packetid.go b/data/packetid/packetid.go index 5d26034..c080c33 100644 --- a/data/packetid/packetid.go +++ b/data/packetid/packetid.go @@ -14,6 +14,7 @@ const ( ClientboundLoginSuccess // GameProfile ClientboundLoginCompression // LoginCompression ClientboundLoginPluginRequest // CustomQuery + ClientboundLoginCookieRequest ) // Login Serverbound @@ -22,6 +23,7 @@ const ( ServerboundLoginEncryptionResponse // Key ServerboundLoginPluginResponse // CustomQueryAnswer ServerboundLoginAcknowledged // LoginAcknowledged + ServerboundLoginCookieResponse ) // Status Clientbound @@ -38,25 +40,35 @@ const ( // Configuration Clientbound const ( - ClientboundConfigCustomPayload ClientboundPacketID = iota + ClientboundConfigCookieRequest ClientboundPacketID = iota + ClientboundConfigCustomPayload ClientboundConfigDisconnect ClientboundConfigFinishConfiguration ClientboundConfigKeepAlive ClientboundConfigPing + ClientboundConfigResetChat ClientboundConfigRegistryData - ClientboundConfigResourcePack + ClientboundConfigResourcePackPop + ClientboundConfigResourcePackPush + ClientboundConfigStoreCookie + ClientboundConfigTransfer ClientboundConfigUpdateEnabledFeatures ClientboundConfigUpdateTags + ClientboundConfigSelectKnownPacks + ClientboundConfigCustomReportDetails + ClientboundConfigServerLinks ) // Configuration Serverbound const ( ServerboundConfigClientInformation ServerboundPacketID = iota + ServerboundConfigCookieResponse ServerboundConfigCustomPayload ServerboundConfigFinishConfiguration ServerboundConfigKeepAlive ServerboundConfigPong ServerboundConfigResourcePack + ServerboundConfigSelectKnownPacks ) // Game Clientbound @@ -83,10 +95,12 @@ const ( ClientboundContainerSetContent ClientboundContainerSetData ClientboundContainerSetSlot + ClientboundCookieRequest ClientboundCooldown ClientboundCustomChatCompletions ClientboundCustomPayload ClientboundDamageEvent + ClientboundDebugSample ClientboundDeleteChat ClientboundDisconnect ClientboundDisguisedChat @@ -166,6 +180,7 @@ const ( ClientboundSound ClientboundStartConfiguration ClientboundStopSound + ClientboundStoreCookie ClientboundSystemChat ClientboundTabList ClientboundTagQuery @@ -173,11 +188,15 @@ const ( ClientboundTeleportEntity ClientboundTickingState ClientboundTickingStep + ClientboundTransfer ClientboundUpdateAdvancements ClientboundUpdateAttributes ClientboundUpdateMobEffect ClientboundUpdateRecipes ClientboundUpdateTags + ClientboundProjectilePower + ClientboundCustomReportDetails + ClientboundServerLinks ClientboundPacketIDGuard ) @@ -188,6 +207,7 @@ const ( ServerboundChangeDifficulty ServerboundChatAck ServerboundChatCommand + ServerboundChatCommandSigned ServerboundChat ServerboundChatSessionUpdate ServerboundChunkBatchReceived @@ -199,7 +219,9 @@ const ( ServerboundContainerClick ServerboundContainerClose ServerboundContainerSlotStateChanged + ServerboundCookieResponse ServerboundCustomPayload + ServerboundDebugSampleSubscription ServerboundEditBook ServerboundEntityTagQuery ServerboundInteract @@ -238,4 +260,5 @@ const ( ServerboundTeleportToEntity ServerboundUseItemOn ServerboundUseItem + ServerboundPacketIDGuard ) diff --git a/data/packetid/serverboundpacketid_string.go b/data/packetid/serverboundpacketid_string.go index 0a1ead8..83abc0e 100644 --- a/data/packetid/serverboundpacketid_string.go +++ b/data/packetid/serverboundpacketid_string.go @@ -12,74 +12,81 @@ func _() { _ = x[ServerboundLoginEncryptionResponse-1] _ = x[ServerboundLoginPluginResponse-2] _ = x[ServerboundLoginAcknowledged-3] + _ = x[ServerboundLoginCookieResponse-4] _ = x[ServerboundStatusRequest-0] _ = x[ServerboundStatusPingRequest-1] _ = x[ServerboundConfigClientInformation-0] - _ = x[ServerboundConfigCustomPayload-1] - _ = x[ServerboundConfigFinishConfiguration-2] - _ = x[ServerboundConfigKeepAlive-3] - _ = x[ServerboundConfigPong-4] - _ = x[ServerboundConfigResourcePack-5] + _ = x[ServerboundConfigCookieResponse-1] + _ = x[ServerboundConfigCustomPayload-2] + _ = x[ServerboundConfigFinishConfiguration-3] + _ = x[ServerboundConfigKeepAlive-4] + _ = x[ServerboundConfigPong-5] + _ = x[ServerboundConfigResourcePack-6] + _ = x[ServerboundConfigSelectKnownPacks-7] _ = x[ServerboundAcceptTeleportation-0] _ = x[ServerboundBlockEntityTagQuery-1] _ = x[ServerboundChangeDifficulty-2] _ = x[ServerboundChatAck-3] _ = x[ServerboundChatCommand-4] - _ = x[ServerboundChat-5] - _ = x[ServerboundChatSessionUpdate-6] - _ = x[ServerboundChunkBatchReceived-7] - _ = x[ServerboundClientCommand-8] - _ = x[ServerboundClientInformation-9] - _ = x[ServerboundCommandSuggestion-10] - _ = x[ServerboundConfigurationAcknowledged-11] - _ = x[ServerboundContainerButtonClick-12] - _ = x[ServerboundContainerClick-13] - _ = x[ServerboundContainerClose-14] - _ = x[ServerboundContainerSlotStateChanged-15] - _ = x[ServerboundCustomPayload-16] - _ = x[ServerboundEditBook-17] - _ = x[ServerboundEntityTagQuery-18] - _ = x[ServerboundInteract-19] - _ = x[ServerboundJigsawGenerate-20] - _ = x[ServerboundKeepAlive-21] - _ = x[ServerboundLockDifficulty-22] - _ = x[ServerboundMovePlayerPos-23] - _ = x[ServerboundMovePlayerPosRot-24] - _ = x[ServerboundMovePlayerRot-25] - _ = x[ServerboundMovePlayerStatusOnly-26] - _ = x[ServerboundMoveVehicle-27] - _ = x[ServerboundPaddleBoat-28] - _ = x[ServerboundPickItem-29] - _ = x[ServerboundPingRequest-30] - _ = x[ServerboundPlaceRecipe-31] - _ = x[ServerboundPlayerAbilities-32] - _ = x[ServerboundPlayerAction-33] - _ = x[ServerboundPlayerCommand-34] - _ = x[ServerboundPlayerInput-35] - _ = x[ServerboundPong-36] - _ = x[ServerboundRecipeBookChangeSettings-37] - _ = x[ServerboundRecipeBookSeenRecipe-38] - _ = x[ServerboundRenameItem-39] - _ = x[ServerboundResourcePack-40] - _ = x[ServerboundSeenAdvancements-41] - _ = x[ServerboundSelectTrade-42] - _ = x[ServerboundSetBeacon-43] - _ = x[ServerboundSetCarriedItem-44] - _ = x[ServerboundSetCommandBlock-45] - _ = x[ServerboundSetCommandMinecart-46] - _ = x[ServerboundSetCreativeModeSlot-47] - _ = x[ServerboundSetJigsawBlock-48] - _ = x[ServerboundSetStructureBlock-49] - _ = x[ServerboundSignUpdate-50] - _ = x[ServerboundSwing-51] - _ = x[ServerboundTeleportToEntity-52] - _ = x[ServerboundUseItemOn-53] - _ = x[ServerboundUseItem-54] + _ = x[ServerboundChatCommandSigned-5] + _ = x[ServerboundChat-6] + _ = x[ServerboundChatSessionUpdate-7] + _ = x[ServerboundChunkBatchReceived-8] + _ = x[ServerboundClientCommand-9] + _ = x[ServerboundClientInformation-10] + _ = x[ServerboundCommandSuggestion-11] + _ = x[ServerboundConfigurationAcknowledged-12] + _ = x[ServerboundContainerButtonClick-13] + _ = x[ServerboundContainerClick-14] + _ = x[ServerboundContainerClose-15] + _ = x[ServerboundContainerSlotStateChanged-16] + _ = x[ServerboundCookieResponse-17] + _ = x[ServerboundCustomPayload-18] + _ = x[ServerboundDebugSampleSubscription-19] + _ = x[ServerboundEditBook-20] + _ = x[ServerboundEntityTagQuery-21] + _ = x[ServerboundInteract-22] + _ = x[ServerboundJigsawGenerate-23] + _ = x[ServerboundKeepAlive-24] + _ = x[ServerboundLockDifficulty-25] + _ = x[ServerboundMovePlayerPos-26] + _ = x[ServerboundMovePlayerPosRot-27] + _ = x[ServerboundMovePlayerRot-28] + _ = x[ServerboundMovePlayerStatusOnly-29] + _ = x[ServerboundMoveVehicle-30] + _ = x[ServerboundPaddleBoat-31] + _ = x[ServerboundPickItem-32] + _ = x[ServerboundPingRequest-33] + _ = x[ServerboundPlaceRecipe-34] + _ = x[ServerboundPlayerAbilities-35] + _ = x[ServerboundPlayerAction-36] + _ = x[ServerboundPlayerCommand-37] + _ = x[ServerboundPlayerInput-38] + _ = x[ServerboundPong-39] + _ = x[ServerboundRecipeBookChangeSettings-40] + _ = x[ServerboundRecipeBookSeenRecipe-41] + _ = x[ServerboundRenameItem-42] + _ = x[ServerboundResourcePack-43] + _ = x[ServerboundSeenAdvancements-44] + _ = x[ServerboundSelectTrade-45] + _ = x[ServerboundSetBeacon-46] + _ = x[ServerboundSetCarriedItem-47] + _ = x[ServerboundSetCommandBlock-48] + _ = x[ServerboundSetCommandMinecart-49] + _ = x[ServerboundSetCreativeModeSlot-50] + _ = x[ServerboundSetJigsawBlock-51] + _ = x[ServerboundSetStructureBlock-52] + _ = x[ServerboundSignUpdate-53] + _ = x[ServerboundSwing-54] + _ = x[ServerboundTeleportToEntity-55] + _ = x[ServerboundUseItemOn-56] + _ = x[ServerboundUseItem-57] + _ = x[ServerboundPacketIDGuard-58] } -const _ServerboundPacketID_name = "ServerboundLoginStartServerboundLoginEncryptionResponseServerboundLoginPluginResponseServerboundLoginAcknowledgedServerboundConfigPongServerboundConfigResourcePackServerboundChatSessionUpdateServerboundChunkBatchReceivedServerboundClientCommandServerboundClientInformationServerboundCommandSuggestionServerboundConfigurationAcknowledgedServerboundContainerButtonClickServerboundContainerClickServerboundContainerCloseServerboundContainerSlotStateChangedServerboundCustomPayloadServerboundEditBookServerboundEntityTagQueryServerboundInteractServerboundJigsawGenerateServerboundKeepAliveServerboundLockDifficultyServerboundMovePlayerPosServerboundMovePlayerPosRotServerboundMovePlayerRotServerboundMovePlayerStatusOnlyServerboundMoveVehicleServerboundPaddleBoatServerboundPickItemServerboundPingRequestServerboundPlaceRecipeServerboundPlayerAbilitiesServerboundPlayerActionServerboundPlayerCommandServerboundPlayerInputServerboundPongServerboundRecipeBookChangeSettingsServerboundRecipeBookSeenRecipeServerboundRenameItemServerboundResourcePackServerboundSeenAdvancementsServerboundSelectTradeServerboundSetBeaconServerboundSetCarriedItemServerboundSetCommandBlockServerboundSetCommandMinecartServerboundSetCreativeModeSlotServerboundSetJigsawBlockServerboundSetStructureBlockServerboundSignUpdateServerboundSwingServerboundTeleportToEntityServerboundUseItemOnServerboundUseItem" +const _ServerboundPacketID_name = "ServerboundLoginStartServerboundLoginEncryptionResponseServerboundLoginPluginResponseServerboundLoginAcknowledgedServerboundLoginCookieResponseServerboundConfigPongServerboundConfigResourcePackServerboundConfigSelectKnownPacksServerboundChunkBatchReceivedServerboundClientCommandServerboundClientInformationServerboundCommandSuggestionServerboundConfigurationAcknowledgedServerboundContainerButtonClickServerboundContainerClickServerboundContainerCloseServerboundContainerSlotStateChangedServerboundCookieResponseServerboundCustomPayloadServerboundDebugSampleSubscriptionServerboundEditBookServerboundEntityTagQueryServerboundInteractServerboundJigsawGenerateServerboundKeepAliveServerboundLockDifficultyServerboundMovePlayerPosServerboundMovePlayerPosRotServerboundMovePlayerRotServerboundMovePlayerStatusOnlyServerboundMoveVehicleServerboundPaddleBoatServerboundPickItemServerboundPingRequestServerboundPlaceRecipeServerboundPlayerAbilitiesServerboundPlayerActionServerboundPlayerCommandServerboundPlayerInputServerboundPongServerboundRecipeBookChangeSettingsServerboundRecipeBookSeenRecipeServerboundRenameItemServerboundResourcePackServerboundSeenAdvancementsServerboundSelectTradeServerboundSetBeaconServerboundSetCarriedItemServerboundSetCommandBlockServerboundSetCommandMinecartServerboundSetCreativeModeSlotServerboundSetJigsawBlockServerboundSetStructureBlockServerboundSignUpdateServerboundSwingServerboundTeleportToEntityServerboundUseItemOnServerboundUseItemServerboundPacketIDGuard" -var _ServerboundPacketID_index = [...]uint16{0, 21, 55, 85, 113, 134, 163, 191, 220, 244, 272, 300, 336, 367, 392, 417, 453, 477, 496, 521, 540, 565, 585, 610, 634, 661, 685, 716, 738, 759, 778, 800, 822, 848, 871, 895, 917, 932, 967, 998, 1019, 1042, 1069, 1091, 1111, 1136, 1162, 1191, 1221, 1246, 1274, 1295, 1311, 1338, 1358, 1376} +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} func (i ServerboundPacketID) String() string { if i < 0 || i >= ServerboundPacketID(len(_ServerboundPacketID_index)-1) {