basin/basin/src/player.h

97 lines
2.2 KiB
C
Raw Normal View History

/*
* 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;
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;
float foodExhaustion;
2017-03-11 20:02:53 +00:00
size_t lastTeleportID;
};
void player_hungerUpdate(struct player* player);
2017-02-06 02:35:21 +00:00
void sendEntityMove(struct player* player, struct entity* ent);
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);
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);
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);
#endif /* PLAYER_H_ */