Player.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include <Array.h>
  3. #include "CraftingStorage.h"
  4. #include "Entity.h"
  5. #include "EntityType.h"
  6. class PlayerEntityType;
  7. class Player : public Entity,
  8. public BasicShapedCrafter
  9. {
  10. public:
  11. class Key
  12. {
  13. public:
  14. static const __int64 LEFT_HAND_ACTION = 0x100;
  15. static const __int64 RIGHT_HAND_ACTION = 0x200;
  16. };
  17. private:
  18. Framework::Text name;
  19. Framework::Array<ItemSlot*> itemBar;
  20. Framework::Array<ItemSlot*> crafting;
  21. int leftHandPosition;
  22. bool jumping;
  23. __int64 keyState;
  24. void useItemSlot(ItemSlot* zSlot);
  25. Player(Framework::Vec3<float> location, int dimensionId, int entityId);
  26. virtual void onTargetChange() override;
  27. Framework::Text getInventoryUIML();
  28. Framework::Text getPlayerGUI();
  29. public:
  30. void setName(Framework::Text name);
  31. const char* getName() const;
  32. void tick(const Dimension* zDimension) override;
  33. void playerApi(
  34. Framework::StreamReader* zRequest, NetworkMessage* zResponse);
  35. void onFall(float collisionSpeed) override;
  36. friend PlayerEntityType;
  37. };
  38. class PlayerEntityType : public EntityType
  39. {
  40. protected:
  41. virtual void loadSuperEntity(
  42. Entity* zEntity, Framework::StreamReader* zReader) const override;
  43. virtual void saveSuperEntity(
  44. Entity* zEntity, Framework::StreamWriter* zWriter) const override;
  45. public:
  46. PlayerEntityType();
  47. virtual Entity* createEntity(Framework::Vec3<float> position,
  48. int dimensionId,
  49. int entityId) const override;
  50. };