Golang chunkymonkey-gamerules.INonPlayerEntity类(方法)实例源码

下面列出了Golang chunkymonkey-gamerules.INonPlayerEntity 类(方法)源码代码实例,从而了解它的用法。

作者:nictuk    项目:chunkymonke   
func (chunk *Chunk) removeEntity(s gamerules.INonPlayerEntity) {
	e := s.GetEntityId()
	chunk.shard.entityMgr.RemoveEntityById(e)
	chunk.entities[e] = nil, false
	// Tell all subscribers that the spawn's entity is destroyed.
	buf := new(bytes.Buffer)
	proto.WriteEntityDestroy(buf, e)
	chunk.reqMulticastPlayers(-1, buf.Bytes())
}

作者:nictuk    项目:chunkymonke   
// 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.
	buf := &bytes.Buffer{}
	s.SendSpawn(buf)
	chunk.reqMulticastPlayers(-1, buf.Bytes())
}

作者:b1naryth1e    项目:chunkymonke   
func (chunk *Chunk) removeEntity(s gamerules.INonPlayerEntity) {
	entityId := s.GetEntityId()
	chunk.shard.entityMgr.RemoveEntityById(entityId)
	delete(chunk.entities, entityId)

	// Tell all subscribers that the spawn's entity is destroyed.
	data := chunk.shard.pktSerial.SerializePackets(&proto.PacketEntityDestroy{EntityCount: 1, EntityId: entityId})
	chunk.reqMulticastPlayers(-1, data)

	chunk.storeDirty = true
}

作者:b1naryth1e    项目:chunkymonke   
// 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
}

作者:nictuk    项目:chunkymonke   
// Tells the chunk to take posession of the item/mob from another chunk.
func (chunk *Chunk) transferEntity(s gamerules.INonPlayerEntity) {
	chunk.entities[s.GetEntityId()] = s
}

作者:huwensh    项目:chunkymonke   
// Tells the chunk to take posession of the item/mob from another chunk.
func (chunk *Chunk) transferEntity(s gamerules.INonPlayerEntity) {
	chunk.entities[s.GetEntityId()] = s
	chunk.storeDirty = true
}


问题


面经


文章

微信
公众号

扫码关注公众号