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()) }
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 }
// 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 }
// 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 }