1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #pragma once
- #include "Entity.h"
- #include "EntityType.h"
- #include "CraftingStorage.h"
- #include <Array.h>
- class PlayerEntityType;
- class Player : public Entity, public BasicShapedCrafter
- {
- public:
- class Key
- {
- public:
- const static __int64 MOVE_FRONT = 0x1;
- const static __int64 MOVE_BACK = 0x2;
- const static __int64 MOVE_LEFT = 0x4;
- const static __int64 MOVE_RIGHT = 0x8;
- const static __int64 MOVE_UP = 0x10;
- const static __int64 MOVE_DOWN = 0x20;
- const static __int64 ROTATE_LEFT = 0x40;
- const static __int64 ROTATE_RIGHT = 0x80;
- const static __int64 LEFT_HAND_ACTION = 0x100;
- const static __int64 RIGHT_HAND_ACTION = 0x200;
- };
- private:
- Framework::Text name;
- Framework::Array<ItemSlot*> itemBar;
- Framework::Array<ItemSlot*> crafting;
- int leftHandPosition;
- bool jumping;
- __int64 keyState;
- void useItemSlot(ItemSlot* zSlot);
- Player(Framework::Vec3<float> location, int dimensionId, int entityId);
- virtual void afterPullStack(ItemSlot* zSlot, Direction dir, const Item* zItem, int count) override;
- virtual void afterPushStack(ItemSlot* zSlot, Direction dir, const Item* zItem, int count) override;
- Framework::Text getInventoryUIML();
- public:
- void setName(Framework::Text name);
- const char* getName() const;
- void tick(const Dimension* zDimension) override;
- void playerApi(Framework::StreamReader* zRequest, NetworkResponse* zResponse);
- void onFall(float collisionSpeed) override;
- friend PlayerEntityType;
- };
- class PlayerEntityType : public EntityType
- {
- REGISTRABLE(PlayerEntityType)
- protected:
- virtual void loadSuperEntity(Entity* zEntity, Framework::StreamReader* zReader) const override;
- virtual void saveSuperEntity(Entity* zEntity, Framework::StreamWriter* zWriter) const override;
- public:
- PlayerEntityType();
- virtual Entity* createEntity(Framework::Vec3<float> position, int dimensionId, int entityId) const override;
- };
- REGISTER(PlayerEntityType, EntityType)
|