void cNBTChunkSerializer::Entity(cEntity * a_Entity) { // Add entity into NBT: if (m_IsTagOpen) { if (!m_HasHadEntity) { m_Writer.EndList(); m_Writer.BeginList("Entities", TAG_Compound); } } else { m_Writer.BeginList("Entities", TAG_Compound); } m_IsTagOpen = true; m_HasHadEntity = true; switch (a_Entity->GetEntityType()) { case cEntity::etFallingBlock: AddFallingBlockEntity((cFallingBlock *) a_Entity); break; case cEntity::etMinecart: AddMinecartEntity ((cMinecart *) a_Entity); break; case cEntity::etMonster: AddMonsterEntity ((cMonster *) a_Entity); break; case cEntity::etPickup: AddPickupEntity ((cPickup *) a_Entity); break; case cEntity::etProjectile: AddProjectileEntity ((cProjectileEntity *)a_Entity); break; case cEntity::etPlayer: return; // Players aren't saved into the world default: { ASSERT(!"Unhandled entity type is being saved"); break; } } }
void cNBTChunkSerializer::Entity(cEntity * a_Entity) { // Add entity into NBT: if (m_IsTagOpen) { if (!m_HasHadEntity) { m_Writer.EndList(); m_Writer.BeginList("Entities", TAG_Compound); } } else { m_Writer.BeginList("Entities", TAG_Compound); } m_IsTagOpen = true; m_HasHadEntity = true; switch (a_Entity->GetEntityType()) { case cEntity::etBoat: AddBoatEntity (reinterpret_cast<cBoat *> (a_Entity)); break; case cEntity::etEnderCrystal: AddEnderCrystalEntity(reinterpret_cast<cEnderCrystal *> (a_Entity)); break; case cEntity::etFallingBlock: AddFallingBlockEntity(reinterpret_cast<cFallingBlock *> (a_Entity)); break; case cEntity::etMinecart: AddMinecartEntity (reinterpret_cast<cMinecart *> (a_Entity)); break; case cEntity::etMonster: AddMonsterEntity (reinterpret_cast<cMonster *> (a_Entity)); break; case cEntity::etPickup: AddPickupEntity (reinterpret_cast<cPickup *> (a_Entity)); break; case cEntity::etProjectile: AddProjectileEntity (reinterpret_cast<cProjectileEntity *>(a_Entity)); break; case cEntity::etTNT: AddTNTEntity (reinterpret_cast<cTNTEntity *> (a_Entity)); break; case cEntity::etExpOrb: AddExpOrbEntity (reinterpret_cast<cExpOrb *> (a_Entity)); break; case cEntity::etItemFrame: AddItemFrameEntity (reinterpret_cast<cItemFrame *> (a_Entity)); break; case cEntity::etPainting: AddPaintingEntity (reinterpret_cast<cPainting *> (a_Entity)); break; case cEntity::etPlayer: return; // Players aren't saved into the world case cEntity::etFloater: return; // Floaters aren't saved either default: { ASSERT(!"Unhandled entity type is being saved"); break; } } }