本文整理匯總了Golang中chunkymonkey/gamerules.INonPlayerEntity.SpawnPackets方法的典型用法代碼示例。如果您正苦於以下問題:Golang INonPlayerEntity.SpawnPackets方法的具體用法?Golang INonPlayerEntity.SpawnPackets怎麽用?Golang INonPlayerEntity.SpawnPackets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類chunkymonkey/gamerules.INonPlayerEntity
的用法示例。
在下文中一共展示了INonPlayerEntity.SpawnPackets方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: AddEntity
// AddEntity creates a mob or item in this chunk and notifies all chunk
// subscribers of the new entity
func (chunk *Chunk) AddEntity(s gamerules.INonPlayerEntity) {
newEntityId := chunk.shard.entityMgr.NewEntity()
s.SetEntityId(newEntityId)
chunk.entities[newEntityId] = s
// Spawn new item/mob for players.
data := chunk.shard.pktSerial.SerializePackets(s.SpawnPackets(nil)...)
chunk.reqMulticastPlayers(-1, data)
chunk.storeDirty = true
}