12-02-2012, 09:54 AM
ok, a little bit to myself - missing pieces in code:
cChunkSender::SendChunk
// TODO: Send entity spawn packets
cChunkSender::Entity
// Nothing needed yet, perhaps in the future when we save entities into chunks we'd like to send them upon load, too
WSSAnvil:
virtual void Entity(cEntity * a_Entity) override
{
// TODO: Add entity into NBT:
}
void cWSSAnvil::LoadEntitiesFromNBT(cEntityList & a_Entitites, const cParsedNBT & a_NBT, int a_TagIdx)
{
// TODO: Load the entities
}
cChunk::SetAllData
m_Entities.splice(m_Entities.end(), a_Entities);
I tried to follow the path how a Entity shoud be created.
First in the FinishingGen or WSSAnvil there shoud be created an Entity (or loaded)
Then it is added to a_Entities which goes finally to cChunk::SetAllData.
Within ChunkSender there ar missing Entities functions (TODO) maybe therefore never an Entity get initialized or broadcasted to the Client ?
Where in the Way up the functions should an Entity be initialized ? When generating/loading or within Chunk::SetAllData or within ChunkSender ?
within world.cpp a mob is generated:
[.. generating mob .. ]
Monster->Initialize(this);
Monster->TeleportTo(a_PosX, a_PosY, a_PosZ);
BroadcastSpawn(*Monster);
so i think Bradcastspawn should be called in ChunkSender ?
cChunkSender::SendChunk
// TODO: Send entity spawn packets
cChunkSender::Entity
// Nothing needed yet, perhaps in the future when we save entities into chunks we'd like to send them upon load, too
WSSAnvil:
virtual void Entity(cEntity * a_Entity) override
{
// TODO: Add entity into NBT:
}
void cWSSAnvil::LoadEntitiesFromNBT(cEntityList & a_Entitites, const cParsedNBT & a_NBT, int a_TagIdx)
{
// TODO: Load the entities
}
cChunk::SetAllData
m_Entities.splice(m_Entities.end(), a_Entities);
I tried to follow the path how a Entity shoud be created.
First in the FinishingGen or WSSAnvil there shoud be created an Entity (or loaded)
Then it is added to a_Entities which goes finally to cChunk::SetAllData.
Within ChunkSender there ar missing Entities functions (TODO) maybe therefore never an Entity get initialized or broadcasted to the Client ?
Where in the Way up the functions should an Entity be initialized ? When generating/loading or within Chunk::SetAllData or within ChunkSender ?
within world.cpp a mob is generated:
[.. generating mob .. ]
Monster->Initialize(this);
Monster->TeleportTo(a_PosX, a_PosY, a_PosZ);
BroadcastSpawn(*Monster);
so i think Bradcastspawn should be called in ChunkSender ?