跳转到正文

协议包与数据模型 ​

从 neomega_runtime.protocol.models 导入协议包和嵌套数据模型,再通过 ctx.packets.typed 编解码、监听和发送。字段名称区分大小写。

协议包用法 · 类型化协议接口 · API 目录

python
from neomega_runtime.protocol import models

packet = models.Text(TextType=1, SourceName="Neomega", Message="你好")

查找模型 ​

按模型名称选择下列分组,也可以使用站点搜索直接查找包名或字段名。

名称范围
AbilityData – AgentCreatedEvent
Animate – AwardAchievement
BeaconPaymentStackRequestAction – BiomeReplacementData__
BiomeScatterParameter – BlockPos__ContainerEntit…known3_bool_
BlockPos__Dimension_int3…sion_string_ – BoxShape
CacheBlob – CameraPreset
CameraPreset_ – ChangeModelOffset
ChangeModelTexture – ClientMovementPredictionSync
ClientStartItemCooldown – CommandParameter
CommandParameter_ – CraftingNeteaseUnknownDataSubEntry
CraftingNeteaseUnknownDataSubEntry_ – Custom
DataStoreChange – DestroyStackRequestAction_
DimensionData – DynamicEnum
EditorNetwork – EntityPhysxShapes
EntityPhysxShapes_ – ExtractHoneyEvent
FeatureRegistry – FurnaceRecipe_
GameRule – GUIDataPickItem
HungerAttr – HurtArmour
Int – ItemEntry
ItemEntry_ – ItemStackResponse_
ItemTagItemDescriptor – ItemWithSlot
JigsawStructureData – JigsawStructureData
LabTable – Login
MapCreateLockedCopy – ModEffectEntry_
MoLangItemDescriptor – MultiRecipe
nat_ – NormalTransactionData
NPCDialogue – NPCRequest
OnScreenTextureAnimation – Optional_uint8__
PacketViolationWarning – PlayerArmourDamage
PlayerArmourDamageEntry – PortalUsedEvent
PositionTrackingDBClientRequest – PyRpc
RaidUpdateEvent – ResourcePacksInfo
ResourcePackStack – RGBA__struct_UUID_github…color_RGBA
ScoreboardEntry – SetDimensionLocalTime
SetDimensionLocalWeather – ShapelessRecipe
ShapelessRecipe_ – StackRequestSlotInfo
StackRequestSlotInfo_ – struct_ActionType_byte__…XUID_string_
struct_ActionType_int32_ – struct_BlockInteractionT…temID_int32_
struct_BossEntityUniqueI…rlay_uint32_ – struct_CopperBlockID_int32_
struct_Count_byte__mapst…mitempty____ – struct_EntityRuntimeID_u…Tick_uint64_
struct_EntityRuntimeID_u…Name_string_ – struct_EventName_string_…Data___byte_
struct_EventType_uint16_ – struct_Identifier_string…ority_int32_
struct_ImageWidth_uint32…Type_uint32_ – struct_LeftInventoryTab_…known_int32_
struct_MaterialID_string…Name_string_ – struct_NoPvM_bool__NoMvP…toJump_bool_
struct_ObjectiveName_string_ – struct_PropertyData_map_string_any_
struct_R_uint8__G_uint8_…t8__A_uint8_ – struct_Slot_byte__Hotbar…ction_int32_
struct_SoundName_string_…Legacy_bool_ – struct_Title_string__Message_string_
struct_TopBlock_int32__M…Depth_int32_ – struct_UUID_string__Chun…Data___byte_
struct_UUID_string__Data…ckType_byte_ – SubChunkOffset_
SubChunkOffset__Result_b…Hash_uint64_ – SyncSkin
TakeItemActor – TrimPattern
Unknown – UUID__RequestID_string__…queID_int64_
UUID__SkinData___byte_ – UUID__Version_string__Si…dURL_string_
VConnection – Vec3__struct_EntityRunti…mgl32_Vec3
Vec3__struct_LineEndLoca…mgl32_Vec3 – Vec3__Volume_float32__Pitch_float32_
WaxedOrUnwaxedCopperEvent – WithdrawFurnaceXp
zone – zoneTrans

注册数据包 ​

按包 ID 查找可用于监听、编解码和发送的模型。

ID模型
1Login
2PlayStatus
3ServerToClientHandshake
4ClientToServerHandshake
5Disconnect
6ResourcePacksInfo
7ResourcePackStack
8ResourcePackClientResponse
9Text
10SetTime
11StartGame
12AddPlayer
13AddActor
14RemoveActor
15AddItemActor
17TakeItemActor
18MoveActorAbsolute
19MovePlayer
21UpdateBlock
22AddPainting
25LevelEvent
26BlockEvent
27ActorEvent
28MobEffect
29UpdateAttributes
30InventoryTransaction
31MobEquipment
32MobArmourEquipment
33Interact
34BlockPickRequest
35ActorPickRequest
36PlayerAction
38HurtArmour
39SetActorData
40SetActorMotion
41SetActorLink
42SetHealth
43SetSpawnPosition
44Animate
45Respawn
46ContainerOpen
47ContainerClose
48PlayerHotBar
49InventoryContent
50InventorySlot
51ContainerSetData
52CraftingData
54GUIDataPickItem
55AdventureSettings
56BlockActorData
58LevelChunk
59SetCommandsEnabled
60SetDifficulty
61ChangeDimension
62SetPlayerGameType
63PlayerList
64SimpleEvent
65Event
66SpawnExperienceOrb
67ClientBoundMapItemData
68MapInfoRequest
69RequestChunkRadius
70ChunkRadiusUpdated
72GameRulesChanged
73Camera
74BossEvent
75ShowCredits
76AvailableCommands
77CommandRequest
78CommandBlockUpdate
79CommandOutput
80UpdateTrade
81UpdateEquip
82ResourcePackDataInfo
83ResourcePackChunkData
84ResourcePackChunkRequest
85Transfer
86PlaySound
87StopSound
88SetTitle
89AddBehaviourTree
90StructureBlockUpdate
91ShowStoreOffer
92PurchaseReceipt
93PlayerSkin
94SubClientLogin
95AutomationClientConnect
96SetLastHurtBy
97BookEdit
98NPCRequest
99PhotoTransfer
100ModalFormRequest
101ModalFormResponse
102ServerSettingsRequest
103ServerSettingsResponse
104ShowProfile
105SetDefaultGameType
106RemoveObjective
107SetDisplayObjective
108SetScore
109LabTable
110UpdateBlockSynced
111MoveActorDelta
112SetScoreboardIdentity
113SetLocalPlayerAsInitialised
114UpdateSoftEnum
115NetworkStackLatency
117ScriptCustomEvent
118SpawnParticleEffect
119AvailableActorIdentifiers
121NetworkChunkPublisherUpdate
122BiomeDefinitionList
123LevelSoundEvent
124LevelEventGeneric
125LecternUpdate
129ClientCacheStatus
130OnScreenTextureAnimation
131MapCreateLockedCopy
132StructureTemplateDataRequest
133StructureTemplateDataResponse
135ClientCacheBlobStatus
136ClientCacheMissResponse
137EducationSettings
138Emote
139MultiPlayerSettings
140SettingsCommand
141AnvilDamage
142CompletedUsingItem
143NetworkSettings
144PlayerAuthInput
145CreativeContent
146PlayerEnchantOptions
147ItemStackRequest
148ItemStackResponse
149PlayerArmourDamage
150CodeBuilder
151UpdatePlayerGameType
152EmoteList
153PositionTrackingDBServerBroadcast
154PositionTrackingDBClientRequest
155DebugInfo
156PacketViolationWarning
157MotionPredictionHints
158AnimateEntity
159CameraShake
160PlayerFog
161CorrectPlayerMovePrediction
162ItemRegistry
163FilterText
164ClientBoundDebugRenderer
165SyncActorProperty
166AddVolumeEntity
167RemoveVolumeEntity
168SimulationType
169NPCDialogue
170EducationResourceURI
171CreatePhoto
172UpdateSubChunkBlocks
173PhotoInfoRequest
174SubChunk
175SubChunkRequest
176ClientStartItemCooldown
177ScriptMessage
178CodeBuilderSource
179TickingAreasLoadStatus
180DimensionData
181AgentAction
182ChangeMobProperty
183LessonProgress
184RequestAbility
185RequestPermissions
186ToastRequest
187UpdateAbilities
188UpdateAdventureSettings
189DeathInfo
190EditorNetwork
191FeatureRegistry
192ServerStats
193RequestNetworkSettings
194GameTestRequest
195GameTestResults
196UpdateClientInputLocks
197ClientCheatAbility
198CameraPresets
199UnlockedRecipes
200PyRpc
201ChangeModel
202StoreBuySucc
203NeteaseJson
204ChangeModelTexture
205ChangeModelOffset
206ChangeModelBind
207HungerAttr
208SetDimensionLocalTime
209WithdrawFurnaceXp
210SetDimensionLocalWeather
211RequestReplayRecordStatus
212ClientInputRecord
213ClientAdditionalReplaySaveData
214ClientLocalReplayOperations
223Addiction
224Combine
225VConnection
226Transport
227Custom
228ConfirmSkin
229TransportNoCompress
230ModEffect
231ModBlockActorChanged
232ChangeActorMotion
233AnimateEmoteEntity
234ChangeBiome
235UpdateBiome
236SyncSkin
300CameraInstruction
302TrimData
303OpenSign
304AgentAnimation
305RefreshEntitlements
306PlayerToggleCrafterSlotRequest
307SetPlayerInventoryOptions
308SetHud
309AwardAchievement
310ClientBoundCloseForm
312ServerBoundLoadingScreen
313JigsawStructureData
314CurrentStructureFeature
315ServerBoundDiagnostics
316CameraAimAssist
317ContainerRegistryCleanup
318MovementEffect
320CameraAimAssistPresets
321ClientCameraAimAssist
322ClientMovementPredictionSync
323UpdateClientOptions
324PlayerVideoCapture
325PlayerUpdateEntityOverrides
326PlayerLocation
327ClientBoundControlSchemeSet
328DebugDrawer
329ServerBoundPackSettingChange
330ClientBoundDataStore
331GraphicsOverrideParameter

字段与构造 ​

模型构造参数均按字段名传入。签名中的 ... 表示该字段可省略;省略时使用字段类型的零值。赋值时会检查字段名称和类型。

所有模型继承 Struct,提供 copy(...) 和 to_value();数据包继承 Packet,另提供 to_envelope()。声明中的 _Struct 与 _Packet 分别是这两个类型的别名。

Optional、联合值、NBT 和特殊浮点数的类型见协议值类型。

模型注册表 ​

SCHEMA ​

python
SCHEMA: dict[str, Any]

REGISTRY ​

python
REGISTRY: _Registry

Neomega · 使用、开发与参考文档