mirror of
https://github.com/p2r3/bareiron.git
synced 2025-10-01 23:25:09 +02:00
add daylight cycle and flight
This commit is contained in:
6
main.c
6
main.c
@@ -16,6 +16,8 @@
|
||||
#include "src/packets.h"
|
||||
#include "src/worldgen.h"
|
||||
|
||||
uint64_t world_time = 0;
|
||||
|
||||
void handlePacket (int client_fd, int length, int packet_id) {
|
||||
|
||||
int state = getClientState(client_fd);
|
||||
@@ -79,6 +81,9 @@ void handlePacket (int client_fd, int length, int packet_id) {
|
||||
}
|
||||
sc_setHeldItem(client_fd, player->hotbar);
|
||||
|
||||
sc_playerAbilities(client_fd, 0x01 + 0x04); // invulnerability + flight
|
||||
sc_updateTime(client_fd, world_time);
|
||||
|
||||
short _x = player->x / 16, _z = player->z / 16;
|
||||
sc_setDefaultSpawnPosition(client_fd, 8, 80, 8);
|
||||
sc_startWaitingForChunks(client_fd);
|
||||
@@ -275,6 +280,7 @@ int main () {
|
||||
clock_gettime(CLOCK_REALTIME, &time_now);
|
||||
if (time_now.tv_sec - keepalive_last.tv_sec > 10) {
|
||||
sc_keepAlive(client_fd);
|
||||
sc_updateTime(client_fd, world_time += 200);
|
||||
clock_gettime(CLOCK_REALTIME, &keepalive_last);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user