PlaceBlockUpdate.cpp 608 B

12345678910111213141516171819202122
  1. #include "PlaceBlockUpdate.h"
  2. #include <Vec3.h>
  3. #include "BlockType.h"
  4. #include "StaticRegistry.h"
  5. #include "Registries.h"
  6. #include "Globals.h"
  7. PlaceBlockUpdateType::PlaceBlockUpdateType()
  8. : WorldUpdateType(ID)
  9. {}
  10. void PlaceBlockUpdateType::applyUpdate(Framework::StreamReader* zReader)
  11. {
  12. Framework::Vec3<int> pos;
  13. zReader->lese((char*)&pos.x, 4);
  14. zReader->lese((char*)&pos.y, 4);
  15. zReader->lese((char*)&pos.z, 4);
  16. unsigned short id;
  17. zReader->lese((char*)&id, 2);
  18. if (blockTypes[id]->doesNeedInstance())
  19. currentGame->zDimension()->setBlock(blockTypes[id]->createBlock(pos));
  20. }