Player.h 1.4 KB

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