mirror of
https://github.com/p2r3/bareiron.git
synced 2025-10-01 23:25:09 +02:00
implement player poses (sneak/sprint)
* Added sending player metadata with poses to everyone * Renamed sendPlayerMetadataToAll to broadcastPlayerMetadata * Made entity metadata system flexible * Made broadcastPlayerMetadata create new metadata instead of using a global one * Moved writeEntityData, sizeEntityData and sizeEntityMetadata to procedures * style nitpicks --------- Co-authored-by: p2r3 <p2r3@p2r3.com>
This commit is contained in:
@@ -248,6 +248,19 @@ typedef struct {
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
union EntityDataValue {
|
||||
uint8_t byte;
|
||||
int pose;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint8_t index;
|
||||
// 0 - Byte
|
||||
// 21 - Pose
|
||||
int type;
|
||||
union EntityDataValue value;
|
||||
} EntityData;
|
||||
|
||||
extern BlockChange block_changes[MAX_BLOCK_CHANGES];
|
||||
extern int block_changes_count;
|
||||
|
||||
|
@@ -48,6 +48,7 @@ int sc_acknowledgeBlockChange (int client_fd, int sequence);
|
||||
int sc_playerInfoUpdateAddPlayer (int client_fd, PlayerData player);
|
||||
int sc_spawnEntity (int client_fd, int id, uint8_t *uuid, int type, double x, double y, double z, uint8_t yaw, uint8_t pitch);
|
||||
int sc_spawnEntityPlayer (int client_fd, PlayerData player);
|
||||
int sc_setEntityMetadata (int client_fd, int id, EntityData *metadata, size_t length);
|
||||
int sc_entityAnimation (int client_fd, int id, uint8_t animation);
|
||||
int sc_teleportEntity (int client_fd, int id, double x, double y, double z, float yaw, float pitch);
|
||||
int sc_setHeadRotation (int client_fd, int id, uint8_t yaw);
|
||||
|
@@ -20,6 +20,8 @@ void disconnectClient (int *client_fd, int cause);
|
||||
int givePlayerItem (PlayerData *player, uint16_t item, uint8_t count);
|
||||
void spawnPlayer (PlayerData *player);
|
||||
|
||||
void broadcastPlayerMetadata (PlayerData *player);
|
||||
|
||||
uint8_t serverSlotToClientSlot (int window_id, uint8_t slot);
|
||||
uint8_t clientSlotToServerSlot (int window_id, uint8_t slot);
|
||||
|
||||
@@ -47,4 +49,9 @@ void handleServerTick (int64_t time_since_last_tick);
|
||||
|
||||
void broadcastChestUpdate (int origin_fd, uint8_t *storage_ptr, uint16_t item, uint8_t count, uint8_t slot);
|
||||
|
||||
ssize_t writeEntityData (int client_fd, EntityData *data);
|
||||
|
||||
int sizeEntityData (EntityData *data);
|
||||
int sizeEntityMetadata (EntityData *metadata, size_t length);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user