2016-06-25 08:34:36 +00:00
|
|
|
/*
|
|
|
|
* player.h
|
|
|
|
*
|
|
|
|
* Created on: Jun 24, 2016
|
|
|
|
* Author: root
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLAYER_H_
|
|
|
|
#define PLAYER_H_
|
|
|
|
|
|
|
|
#include "network.h"
|
|
|
|
|
2017-01-03 19:51:34 +00:00
|
|
|
typedef struct _acstate {
|
|
|
|
} acstate_t;
|
|
|
|
|
2016-06-25 08:34:36 +00:00
|
|
|
struct player {
|
2017-02-06 02:35:21 +00:00
|
|
|
struct entity* entity;
|
|
|
|
struct world* world;
|
|
|
|
char* name;
|
|
|
|
struct uuid uuid;
|
|
|
|
struct conn* conn;
|
|
|
|
uint16_t currentItem;
|
|
|
|
uint8_t gamemode;
|
|
|
|
uint8_t ping;
|
|
|
|
uint8_t stage;
|
|
|
|
uint8_t invulnerable;
|
|
|
|
float walkSpeed;
|
|
|
|
float flySpeed;
|
|
|
|
uint8_t flying;
|
|
|
|
int32_t xpseed;
|
|
|
|
int32_t xptotal;
|
|
|
|
int32_t xplevel;
|
|
|
|
int32_t score;
|
|
|
|
float saturation;
|
|
|
|
int8_t sleeping;
|
|
|
|
int16_t fire;
|
2017-03-05 00:11:19 +00:00
|
|
|
uint32_t itemUseDuration;
|
|
|
|
uint8_t itemUseHand;
|
|
|
|
//TODO: enderitems inv
|
2017-02-06 02:35:21 +00:00
|
|
|
int32_t food;
|
|
|
|
int32_t foodTick;
|
|
|
|
int32_t nextKeepAlive;
|
|
|
|
struct encpos digging_position;
|
|
|
|
float digging;
|
|
|
|
float digspeed;
|
|
|
|
struct inventory* inventory;
|
|
|
|
struct inventory* openInv;
|
|
|
|
struct hashmap* loadedChunks;
|
|
|
|
struct hashmap* loadedEntities;
|
|
|
|
struct queue* outgoingPacket;
|
|
|
|
struct queue* incomingPacket;
|
|
|
|
uint8_t defunct;
|
|
|
|
struct slot* inHand;
|
|
|
|
size_t lastSwing;
|
|
|
|
uint8_t foodTimer;
|
|
|
|
uint8_t spawnedIn;
|
|
|
|
size_t llTick;
|
|
|
|
uint8_t triggerRechunk;
|
|
|
|
uint32_t protocolVersion;
|
|
|
|
uint16_t chunksSent;
|
|
|
|
float reachDistance;
|
|
|
|
acstate_t acstate;
|
2017-03-05 00:11:19 +00:00
|
|
|
struct queue* chunkRequests;
|
2017-03-05 18:22:00 +00:00
|
|
|
float foodExhaustion;
|
2017-03-11 20:02:53 +00:00
|
|
|
size_t lastTeleportID;
|
2016-06-25 08:34:36 +00:00
|
|
|
};
|
|
|
|
|
2017-03-05 18:22:00 +00:00
|
|
|
void player_hungerUpdate(struct player* player);
|
|
|
|
|
2017-02-06 02:35:21 +00:00
|
|
|
void sendEntityMove(struct player* player, struct entity* ent);
|
|
|
|
|
2016-06-25 08:34:36 +00:00
|
|
|
struct player* newPlayer(struct entity* entity, char* name, struct uuid, struct conn* conn, uint8_t gamemode);
|
|
|
|
|
2017-01-03 19:18:52 +00:00
|
|
|
void player_receive_packet(struct player* player, struct packet* inp);
|
|
|
|
|
|
|
|
void tick_player(struct world* world, struct player* player);
|
|
|
|
|
2016-12-30 08:12:04 +00:00
|
|
|
void kickPlayer(struct player* player, char* message);
|
|
|
|
|
|
|
|
int player_onGround(struct player* player);
|
|
|
|
|
2016-12-30 03:18:53 +00:00
|
|
|
void player_closeWindow(struct player* player, uint16_t windowID);
|
|
|
|
|
2016-12-29 08:00:22 +00:00
|
|
|
float player_getAttackStrength(struct player* player, float adjust);
|
|
|
|
|
|
|
|
void teleportPlayer(struct player* player, double x, double y, double z);
|
|
|
|
|
2016-12-30 03:18:53 +00:00
|
|
|
struct player* getPlayerByName(char* name);
|
|
|
|
|
|
|
|
void setPlayerGamemode(struct player* player, int gamemode);
|
|
|
|
|
2016-06-25 08:34:36 +00:00
|
|
|
void freePlayer(struct player* player);
|
|
|
|
|
2018-01-16 21:26:15 +00:00
|
|
|
block canPlayerPlaceBlock(struct player* player, uint16_t blk, int32_t x, int32_t y, int32_t z, uint8_t face);
|
2017-09-10 03:00:32 +00:00
|
|
|
|
2016-06-25 08:34:36 +00:00
|
|
|
#endif /* PLAYER_H_ */
|