update packetid to 1.21

fix compile issue
This commit is contained in:
Tnze
2024-06-15 17:36:13 +08:00
parent 62c9d72851
commit fff914a786
6 changed files with 265 additions and 220 deletions

View File

@ -105,7 +105,8 @@ func (c *Client) joinConfiguration(conn *net.Conn) error {
return ConfigErr{"registry data", err} return ConfigErr{"registry data", err}
} }
case packetid.ClientboundConfigResourcePack: case packetid.ClientboundConfigResourcePackPop: // TODO
case packetid.ClientboundConfigResourcePackPush:
var Url, Hash pk.String var Url, Hash pk.String
var Forced pk.Boolean var Forced pk.Boolean
var PromptMessage pk.Option[chat.Message, *chat.Message] var PromptMessage pk.Option[chat.Message, *chat.Message]

View File

@ -13,17 +13,26 @@ func _() {
_ = x[ClientboundLoginSuccess-2] _ = x[ClientboundLoginSuccess-2]
_ = x[ClientboundLoginCompression-3] _ = x[ClientboundLoginCompression-3]
_ = x[ClientboundLoginPluginRequest-4] _ = x[ClientboundLoginPluginRequest-4]
_ = x[ClientboundLoginCookieRequest-5]
_ = x[ClientboundStatusResponse-0] _ = x[ClientboundStatusResponse-0]
_ = x[ClientboundStatusPongResponse-1] _ = x[ClientboundStatusPongResponse-1]
_ = x[ClientboundConfigCustomPayload-0] _ = x[ClientboundConfigCookieRequest-0]
_ = x[ClientboundConfigDisconnect-1] _ = x[ClientboundConfigCustomPayload-1]
_ = x[ClientboundConfigFinishConfiguration-2] _ = x[ClientboundConfigDisconnect-2]
_ = x[ClientboundConfigKeepAlive-3] _ = x[ClientboundConfigFinishConfiguration-3]
_ = x[ClientboundConfigPing-4] _ = x[ClientboundConfigKeepAlive-4]
_ = x[ClientboundConfigRegistryData-5] _ = x[ClientboundConfigPing-5]
_ = x[ClientboundConfigResourcePack-6] _ = x[ClientboundConfigResetChat-6]
_ = x[ClientboundConfigUpdateEnabledFeatures-7] _ = x[ClientboundConfigRegistryData-7]
_ = x[ClientboundConfigUpdateTags-8] _ = 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[BundleDelimiter-0]
_ = x[ClientboundAddEntity-1] _ = x[ClientboundAddEntity-1]
_ = x[ClientboundAddExperienceOrb-2] _ = x[ClientboundAddExperienceOrb-2]
@ -46,107 +55,114 @@ func _() {
_ = x[ClientboundContainerSetContent-19] _ = x[ClientboundContainerSetContent-19]
_ = x[ClientboundContainerSetData-20] _ = x[ClientboundContainerSetData-20]
_ = x[ClientboundContainerSetSlot-21] _ = x[ClientboundContainerSetSlot-21]
_ = x[ClientboundCooldown-22] _ = x[ClientboundCookieRequest-22]
_ = x[ClientboundCustomChatCompletions-23] _ = x[ClientboundCooldown-23]
_ = x[ClientboundCustomPayload-24] _ = x[ClientboundCustomChatCompletions-24]
_ = x[ClientboundDamageEvent-25] _ = x[ClientboundCustomPayload-25]
_ = x[ClientboundDeleteChat-26] _ = x[ClientboundDamageEvent-26]
_ = x[ClientboundDisconnect-27] _ = x[ClientboundDebugSample-27]
_ = x[ClientboundDisguisedChat-28] _ = x[ClientboundDeleteChat-28]
_ = x[ClientboundEntityEvent-29] _ = x[ClientboundDisconnect-29]
_ = x[ClientboundExplode-30] _ = x[ClientboundDisguisedChat-30]
_ = x[ClientboundForgetLevelChunk-31] _ = x[ClientboundEntityEvent-31]
_ = x[ClientboundGameEvent-32] _ = x[ClientboundExplode-32]
_ = x[ClientboundHorseScreenOpen-33] _ = x[ClientboundForgetLevelChunk-33]
_ = x[ClientboundHurtAnimation-34] _ = x[ClientboundGameEvent-34]
_ = x[ClientboundInitializeBorder-35] _ = x[ClientboundHorseScreenOpen-35]
_ = x[ClientboundKeepAlive-36] _ = x[ClientboundHurtAnimation-36]
_ = x[ClientboundLevelChunkWithLight-37] _ = x[ClientboundInitializeBorder-37]
_ = x[ClientboundLevelEvent-38] _ = x[ClientboundKeepAlive-38]
_ = x[ClientboundLevelParticles-39] _ = x[ClientboundLevelChunkWithLight-39]
_ = x[ClientboundLightUpdate-40] _ = x[ClientboundLevelEvent-40]
_ = x[ClientboundLogin-41] _ = x[ClientboundLevelParticles-41]
_ = x[ClientboundMapItemData-42] _ = x[ClientboundLightUpdate-42]
_ = x[ClientboundMerchantOffers-43] _ = x[ClientboundLogin-43]
_ = x[ClientboundMoveEntityPos-44] _ = x[ClientboundMapItemData-44]
_ = x[ClientboundMoveEntityPosRot-45] _ = x[ClientboundMerchantOffers-45]
_ = x[ClientboundMoveEntityRot-46] _ = x[ClientboundMoveEntityPos-46]
_ = x[ClientboundMoveVehicle-47] _ = x[ClientboundMoveEntityPosRot-47]
_ = x[ClientboundOpenBook-48] _ = x[ClientboundMoveEntityRot-48]
_ = x[ClientboundOpenScreen-49] _ = x[ClientboundMoveVehicle-49]
_ = x[ClientboundOpenSignEditor-50] _ = x[ClientboundOpenBook-50]
_ = x[ClientboundPing-51] _ = x[ClientboundOpenScreen-51]
_ = x[ClientboundPongResponse-52] _ = x[ClientboundOpenSignEditor-52]
_ = x[ClientboundPlaceGhostRecipe-53] _ = x[ClientboundPing-53]
_ = x[ClientboundPlayerAbilities-54] _ = x[ClientboundPongResponse-54]
_ = x[ClientboundPlayerChat-55] _ = x[ClientboundPlaceGhostRecipe-55]
_ = x[ClientboundPlayerCombatEnd-56] _ = x[ClientboundPlayerAbilities-56]
_ = x[ClientboundPlayerCombatEnter-57] _ = x[ClientboundPlayerChat-57]
_ = x[ClientboundPlayerCombatKill-58] _ = x[ClientboundPlayerCombatEnd-58]
_ = x[ClientboundPlayerInfoRemove-59] _ = x[ClientboundPlayerCombatEnter-59]
_ = x[ClientboundPlayerInfoUpdate-60] _ = x[ClientboundPlayerCombatKill-60]
_ = x[ClientboundPlayerLookAt-61] _ = x[ClientboundPlayerInfoRemove-61]
_ = x[ClientboundPlayerPosition-62] _ = x[ClientboundPlayerInfoUpdate-62]
_ = x[ClientboundRecipe-63] _ = x[ClientboundPlayerLookAt-63]
_ = x[ClientboundRemoveEntities-64] _ = x[ClientboundPlayerPosition-64]
_ = x[ClientboundRemoveMobEffect-65] _ = x[ClientboundRecipe-65]
_ = x[ClientboundResetScore-66] _ = x[ClientboundRemoveEntities-66]
_ = x[ClientboundResourcePackPop-67] _ = x[ClientboundRemoveMobEffect-67]
_ = x[ClientboundResourcePackPush-68] _ = x[ClientboundResetScore-68]
_ = x[ClientboundRespawn-69] _ = x[ClientboundResourcePackPop-69]
_ = x[ClientboundRotateHead-70] _ = x[ClientboundResourcePackPush-70]
_ = x[ClientboundSectionBlocksUpdate-71] _ = x[ClientboundRespawn-71]
_ = x[ClientboundSelectAdvancementsTab-72] _ = x[ClientboundRotateHead-72]
_ = x[ClientboundServerData-73] _ = x[ClientboundSectionBlocksUpdate-73]
_ = x[ClientboundSetActionBarText-74] _ = x[ClientboundSelectAdvancementsTab-74]
_ = x[ClientboundSetBorderCenter-75] _ = x[ClientboundServerData-75]
_ = x[ClientboundSetBorderLerpSize-76] _ = x[ClientboundSetActionBarText-76]
_ = x[ClientboundSetBorderSize-77] _ = x[ClientboundSetBorderCenter-77]
_ = x[ClientboundSetBorderWarningDelay-78] _ = x[ClientboundSetBorderLerpSize-78]
_ = x[ClientboundSetBorderWarningDistance-79] _ = x[ClientboundSetBorderSize-79]
_ = x[ClientboundSetCamera-80] _ = x[ClientboundSetBorderWarningDelay-80]
_ = x[ClientboundSetCarriedItem-81] _ = x[ClientboundSetBorderWarningDistance-81]
_ = x[ClientboundSetChunkCacheCenter-82] _ = x[ClientboundSetCamera-82]
_ = x[ClientboundSetChunkCacheRadius-83] _ = x[ClientboundSetCarriedItem-83]
_ = x[ClientboundSetDefaultSpawnPosition-84] _ = x[ClientboundSetChunkCacheCenter-84]
_ = x[ClientboundSetDisplayObjective-85] _ = x[ClientboundSetChunkCacheRadius-85]
_ = x[ClientboundSetEntityData-86] _ = x[ClientboundSetDefaultSpawnPosition-86]
_ = x[ClientboundSetEntityLink-87] _ = x[ClientboundSetDisplayObjective-87]
_ = x[ClientboundSetEntityMotion-88] _ = x[ClientboundSetEntityData-88]
_ = x[ClientboundSetEquipment-89] _ = x[ClientboundSetEntityLink-89]
_ = x[ClientboundSetExperience-90] _ = x[ClientboundSetEntityMotion-90]
_ = x[ClientboundSetHealth-91] _ = x[ClientboundSetEquipment-91]
_ = x[ClientboundSetObjective-92] _ = x[ClientboundSetExperience-92]
_ = x[ClientboundSetPassengers-93] _ = x[ClientboundSetHealth-93]
_ = x[ClientboundSetPlayerTeam-94] _ = x[ClientboundSetObjective-94]
_ = x[ClientboundSetScore-95] _ = x[ClientboundSetPassengers-95]
_ = x[ClientboundSetSimulationDistance-96] _ = x[ClientboundSetPlayerTeam-96]
_ = x[ClientboundSetSubtitleText-97] _ = x[ClientboundSetScore-97]
_ = x[ClientboundSetTime-98] _ = x[ClientboundSetSimulationDistance-98]
_ = x[ClientboundSetTitleText-99] _ = x[ClientboundSetSubtitleText-99]
_ = x[ClientboundSetTitlesAnimation-100] _ = x[ClientboundSetTime-100]
_ = x[ClientboundSoundEntity-101] _ = x[ClientboundSetTitleText-101]
_ = x[ClientboundSound-102] _ = x[ClientboundSetTitlesAnimation-102]
_ = x[ClientboundStartConfiguration-103] _ = x[ClientboundSoundEntity-103]
_ = x[ClientboundStopSound-104] _ = x[ClientboundSound-104]
_ = x[ClientboundSystemChat-105] _ = x[ClientboundStartConfiguration-105]
_ = x[ClientboundTabList-106] _ = x[ClientboundStopSound-106]
_ = x[ClientboundTagQuery-107] _ = x[ClientboundStoreCookie-107]
_ = x[ClientboundTakeItemEntity-108] _ = x[ClientboundSystemChat-108]
_ = x[ClientboundTeleportEntity-109] _ = x[ClientboundTabList-109]
_ = x[ClientboundTickingState-110] _ = x[ClientboundTagQuery-110]
_ = x[ClientboundTickingStep-111] _ = x[ClientboundTakeItemEntity-111]
_ = x[ClientboundUpdateAdvancements-112] _ = x[ClientboundTeleportEntity-112]
_ = x[ClientboundUpdateAttributes-113] _ = x[ClientboundTickingState-113]
_ = x[ClientboundUpdateMobEffect-114] _ = x[ClientboundTickingStep-114]
_ = x[ClientboundUpdateRecipes-115] _ = x[ClientboundTransfer-115]
_ = x[ClientboundUpdateTags-116] _ = x[ClientboundUpdateAdvancements-116]
_ = x[ClientboundPacketIDGuard-117] _ = 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 { func (i ClientboundPacketID) String() string {
if i < 0 || i >= ClientboundPacketID(len(_ClientboundPacketID_index)-1) { if i < 0 || i >= ClientboundPacketID(len(_ClientboundPacketID_index)-1) {

View File

@ -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');
}
}

View File

@ -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<Class<? extends Packet<?>>> packets) throws IOException {
for (int i = 0; i < packets.size(); i++) {
Class<? extends Packet<?>> 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');
}
}

View File

@ -14,6 +14,7 @@ const (
ClientboundLoginSuccess // GameProfile ClientboundLoginSuccess // GameProfile
ClientboundLoginCompression // LoginCompression ClientboundLoginCompression // LoginCompression
ClientboundLoginPluginRequest // CustomQuery ClientboundLoginPluginRequest // CustomQuery
ClientboundLoginCookieRequest
) )
// Login Serverbound // Login Serverbound
@ -22,6 +23,7 @@ const (
ServerboundLoginEncryptionResponse // Key ServerboundLoginEncryptionResponse // Key
ServerboundLoginPluginResponse // CustomQueryAnswer ServerboundLoginPluginResponse // CustomQueryAnswer
ServerboundLoginAcknowledged // LoginAcknowledged ServerboundLoginAcknowledged // LoginAcknowledged
ServerboundLoginCookieResponse
) )
// Status Clientbound // Status Clientbound
@ -38,25 +40,35 @@ const (
// Configuration Clientbound // Configuration Clientbound
const ( const (
ClientboundConfigCustomPayload ClientboundPacketID = iota ClientboundConfigCookieRequest ClientboundPacketID = iota
ClientboundConfigCustomPayload
ClientboundConfigDisconnect ClientboundConfigDisconnect
ClientboundConfigFinishConfiguration ClientboundConfigFinishConfiguration
ClientboundConfigKeepAlive ClientboundConfigKeepAlive
ClientboundConfigPing ClientboundConfigPing
ClientboundConfigResetChat
ClientboundConfigRegistryData ClientboundConfigRegistryData
ClientboundConfigResourcePack ClientboundConfigResourcePackPop
ClientboundConfigResourcePackPush
ClientboundConfigStoreCookie
ClientboundConfigTransfer
ClientboundConfigUpdateEnabledFeatures ClientboundConfigUpdateEnabledFeatures
ClientboundConfigUpdateTags ClientboundConfigUpdateTags
ClientboundConfigSelectKnownPacks
ClientboundConfigCustomReportDetails
ClientboundConfigServerLinks
) )
// Configuration Serverbound // Configuration Serverbound
const ( const (
ServerboundConfigClientInformation ServerboundPacketID = iota ServerboundConfigClientInformation ServerboundPacketID = iota
ServerboundConfigCookieResponse
ServerboundConfigCustomPayload ServerboundConfigCustomPayload
ServerboundConfigFinishConfiguration ServerboundConfigFinishConfiguration
ServerboundConfigKeepAlive ServerboundConfigKeepAlive
ServerboundConfigPong ServerboundConfigPong
ServerboundConfigResourcePack ServerboundConfigResourcePack
ServerboundConfigSelectKnownPacks
) )
// Game Clientbound // Game Clientbound
@ -83,10 +95,12 @@ const (
ClientboundContainerSetContent ClientboundContainerSetContent
ClientboundContainerSetData ClientboundContainerSetData
ClientboundContainerSetSlot ClientboundContainerSetSlot
ClientboundCookieRequest
ClientboundCooldown ClientboundCooldown
ClientboundCustomChatCompletions ClientboundCustomChatCompletions
ClientboundCustomPayload ClientboundCustomPayload
ClientboundDamageEvent ClientboundDamageEvent
ClientboundDebugSample
ClientboundDeleteChat ClientboundDeleteChat
ClientboundDisconnect ClientboundDisconnect
ClientboundDisguisedChat ClientboundDisguisedChat
@ -166,6 +180,7 @@ const (
ClientboundSound ClientboundSound
ClientboundStartConfiguration ClientboundStartConfiguration
ClientboundStopSound ClientboundStopSound
ClientboundStoreCookie
ClientboundSystemChat ClientboundSystemChat
ClientboundTabList ClientboundTabList
ClientboundTagQuery ClientboundTagQuery
@ -173,11 +188,15 @@ const (
ClientboundTeleportEntity ClientboundTeleportEntity
ClientboundTickingState ClientboundTickingState
ClientboundTickingStep ClientboundTickingStep
ClientboundTransfer
ClientboundUpdateAdvancements ClientboundUpdateAdvancements
ClientboundUpdateAttributes ClientboundUpdateAttributes
ClientboundUpdateMobEffect ClientboundUpdateMobEffect
ClientboundUpdateRecipes ClientboundUpdateRecipes
ClientboundUpdateTags ClientboundUpdateTags
ClientboundProjectilePower
ClientboundCustomReportDetails
ClientboundServerLinks
ClientboundPacketIDGuard ClientboundPacketIDGuard
) )
@ -188,6 +207,7 @@ const (
ServerboundChangeDifficulty ServerboundChangeDifficulty
ServerboundChatAck ServerboundChatAck
ServerboundChatCommand ServerboundChatCommand
ServerboundChatCommandSigned
ServerboundChat ServerboundChat
ServerboundChatSessionUpdate ServerboundChatSessionUpdate
ServerboundChunkBatchReceived ServerboundChunkBatchReceived
@ -199,7 +219,9 @@ const (
ServerboundContainerClick ServerboundContainerClick
ServerboundContainerClose ServerboundContainerClose
ServerboundContainerSlotStateChanged ServerboundContainerSlotStateChanged
ServerboundCookieResponse
ServerboundCustomPayload ServerboundCustomPayload
ServerboundDebugSampleSubscription
ServerboundEditBook ServerboundEditBook
ServerboundEntityTagQuery ServerboundEntityTagQuery
ServerboundInteract ServerboundInteract
@ -238,4 +260,5 @@ const (
ServerboundTeleportToEntity ServerboundTeleportToEntity
ServerboundUseItemOn ServerboundUseItemOn
ServerboundUseItem ServerboundUseItem
ServerboundPacketIDGuard
) )

View File

@ -12,74 +12,81 @@ func _() {
_ = x[ServerboundLoginEncryptionResponse-1] _ = x[ServerboundLoginEncryptionResponse-1]
_ = x[ServerboundLoginPluginResponse-2] _ = x[ServerboundLoginPluginResponse-2]
_ = x[ServerboundLoginAcknowledged-3] _ = x[ServerboundLoginAcknowledged-3]
_ = x[ServerboundLoginCookieResponse-4]
_ = x[ServerboundStatusRequest-0] _ = x[ServerboundStatusRequest-0]
_ = x[ServerboundStatusPingRequest-1] _ = x[ServerboundStatusPingRequest-1]
_ = x[ServerboundConfigClientInformation-0] _ = x[ServerboundConfigClientInformation-0]
_ = x[ServerboundConfigCustomPayload-1] _ = x[ServerboundConfigCookieResponse-1]
_ = x[ServerboundConfigFinishConfiguration-2] _ = x[ServerboundConfigCustomPayload-2]
_ = x[ServerboundConfigKeepAlive-3] _ = x[ServerboundConfigFinishConfiguration-3]
_ = x[ServerboundConfigPong-4] _ = x[ServerboundConfigKeepAlive-4]
_ = x[ServerboundConfigResourcePack-5] _ = x[ServerboundConfigPong-5]
_ = x[ServerboundConfigResourcePack-6]
_ = x[ServerboundConfigSelectKnownPacks-7]
_ = x[ServerboundAcceptTeleportation-0] _ = x[ServerboundAcceptTeleportation-0]
_ = x[ServerboundBlockEntityTagQuery-1] _ = x[ServerboundBlockEntityTagQuery-1]
_ = x[ServerboundChangeDifficulty-2] _ = x[ServerboundChangeDifficulty-2]
_ = x[ServerboundChatAck-3] _ = x[ServerboundChatAck-3]
_ = x[ServerboundChatCommand-4] _ = x[ServerboundChatCommand-4]
_ = x[ServerboundChat-5] _ = x[ServerboundChatCommandSigned-5]
_ = x[ServerboundChatSessionUpdate-6] _ = x[ServerboundChat-6]
_ = x[ServerboundChunkBatchReceived-7] _ = x[ServerboundChatSessionUpdate-7]
_ = x[ServerboundClientCommand-8] _ = x[ServerboundChunkBatchReceived-8]
_ = x[ServerboundClientInformation-9] _ = x[ServerboundClientCommand-9]
_ = x[ServerboundCommandSuggestion-10] _ = x[ServerboundClientInformation-10]
_ = x[ServerboundConfigurationAcknowledged-11] _ = x[ServerboundCommandSuggestion-11]
_ = x[ServerboundContainerButtonClick-12] _ = x[ServerboundConfigurationAcknowledged-12]
_ = x[ServerboundContainerClick-13] _ = x[ServerboundContainerButtonClick-13]
_ = x[ServerboundContainerClose-14] _ = x[ServerboundContainerClick-14]
_ = x[ServerboundContainerSlotStateChanged-15] _ = x[ServerboundContainerClose-15]
_ = x[ServerboundCustomPayload-16] _ = x[ServerboundContainerSlotStateChanged-16]
_ = x[ServerboundEditBook-17] _ = x[ServerboundCookieResponse-17]
_ = x[ServerboundEntityTagQuery-18] _ = x[ServerboundCustomPayload-18]
_ = x[ServerboundInteract-19] _ = x[ServerboundDebugSampleSubscription-19]
_ = x[ServerboundJigsawGenerate-20] _ = x[ServerboundEditBook-20]
_ = x[ServerboundKeepAlive-21] _ = x[ServerboundEntityTagQuery-21]
_ = x[ServerboundLockDifficulty-22] _ = x[ServerboundInteract-22]
_ = x[ServerboundMovePlayerPos-23] _ = x[ServerboundJigsawGenerate-23]
_ = x[ServerboundMovePlayerPosRot-24] _ = x[ServerboundKeepAlive-24]
_ = x[ServerboundMovePlayerRot-25] _ = x[ServerboundLockDifficulty-25]
_ = x[ServerboundMovePlayerStatusOnly-26] _ = x[ServerboundMovePlayerPos-26]
_ = x[ServerboundMoveVehicle-27] _ = x[ServerboundMovePlayerPosRot-27]
_ = x[ServerboundPaddleBoat-28] _ = x[ServerboundMovePlayerRot-28]
_ = x[ServerboundPickItem-29] _ = x[ServerboundMovePlayerStatusOnly-29]
_ = x[ServerboundPingRequest-30] _ = x[ServerboundMoveVehicle-30]
_ = x[ServerboundPlaceRecipe-31] _ = x[ServerboundPaddleBoat-31]
_ = x[ServerboundPlayerAbilities-32] _ = x[ServerboundPickItem-32]
_ = x[ServerboundPlayerAction-33] _ = x[ServerboundPingRequest-33]
_ = x[ServerboundPlayerCommand-34] _ = x[ServerboundPlaceRecipe-34]
_ = x[ServerboundPlayerInput-35] _ = x[ServerboundPlayerAbilities-35]
_ = x[ServerboundPong-36] _ = x[ServerboundPlayerAction-36]
_ = x[ServerboundRecipeBookChangeSettings-37] _ = x[ServerboundPlayerCommand-37]
_ = x[ServerboundRecipeBookSeenRecipe-38] _ = x[ServerboundPlayerInput-38]
_ = x[ServerboundRenameItem-39] _ = x[ServerboundPong-39]
_ = x[ServerboundResourcePack-40] _ = x[ServerboundRecipeBookChangeSettings-40]
_ = x[ServerboundSeenAdvancements-41] _ = x[ServerboundRecipeBookSeenRecipe-41]
_ = x[ServerboundSelectTrade-42] _ = x[ServerboundRenameItem-42]
_ = x[ServerboundSetBeacon-43] _ = x[ServerboundResourcePack-43]
_ = x[ServerboundSetCarriedItem-44] _ = x[ServerboundSeenAdvancements-44]
_ = x[ServerboundSetCommandBlock-45] _ = x[ServerboundSelectTrade-45]
_ = x[ServerboundSetCommandMinecart-46] _ = x[ServerboundSetBeacon-46]
_ = x[ServerboundSetCreativeModeSlot-47] _ = x[ServerboundSetCarriedItem-47]
_ = x[ServerboundSetJigsawBlock-48] _ = x[ServerboundSetCommandBlock-48]
_ = x[ServerboundSetStructureBlock-49] _ = x[ServerboundSetCommandMinecart-49]
_ = x[ServerboundSignUpdate-50] _ = x[ServerboundSetCreativeModeSlot-50]
_ = x[ServerboundSwing-51] _ = x[ServerboundSetJigsawBlock-51]
_ = x[ServerboundTeleportToEntity-52] _ = x[ServerboundSetStructureBlock-52]
_ = x[ServerboundUseItemOn-53] _ = x[ServerboundSignUpdate-53]
_ = x[ServerboundUseItem-54] _ = 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 { func (i ServerboundPacketID) String() string {
if i < 0 || i >= ServerboundPacketID(len(_ServerboundPacketID_index)-1) { if i < 0 || i >= ServerboundPacketID(len(_ServerboundPacketID_index)-1) {