diff --git a/build.sh b/build.sh index 46e2472..e5fd006 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ rm bareiron -gcc main.c src/*.c -o bareiron +gcc src/*.c -o bareiron ./bareiron diff --git a/src/main.c b/src/main.c index e49c8ad..2e6c8f7 100644 --- a/src/main.c +++ b/src/main.c @@ -20,12 +20,12 @@ #include #endif -#include "src/globals.h" -#include "src/tools.h" -#include "src/varnum.h" -#include "src/packets.h" -#include "src/worldgen.h" -#include "src/registries.h" +#include "globals.h" +#include "tools.h" +#include "varnum.h" +#include "packets.h" +#include "worldgen.h" +#include "registries.h" uint64_t world_time = 0; @@ -251,7 +251,6 @@ int main () { int server_fd, client_fd, opt = 1; struct sockaddr_in server_addr, client_addr; socklen_t addr_len = sizeof(client_addr); - struct sockaddr_in addr; // Create socket server_fd = socket(AF_INET, SOCK_STREAM, 0); diff --git a/src/packets.c b/src/packets.c index 8240977..b2d63c7 100644 --- a/src/packets.c +++ b/src/packets.c @@ -226,7 +226,7 @@ int sc_synchronizePlayerPosition (int client_fd, double x, double y, double z, f } // S->C Set Default Spawn Position -int sc_setDefaultSpawnPosition (int client_fd, long x, long y, long z) { +int sc_setDefaultSpawnPosition (int client_fd, int64_t x, int64_t y, int64_t z) { writeVarInt(client_fd, sizeVarInt(0x5A) + 12); writeVarInt(client_fd, 0x5A); diff --git a/src/packets.h b/src/packets.h index 957c127..6424d7f 100644 --- a/src/packets.h +++ b/src/packets.h @@ -17,7 +17,7 @@ int sc_knownPacks (int client_fd); int sc_finishConfiguration (int client_fd); int sc_loginPlay (int client_fd); int sc_synchronizePlayerPosition (int client_fd, double x, double y, double z, float yaw, float pitch); -int sc_setDefaultSpawnPosition (int client_fd, long x, long y, long z); +int sc_setDefaultSpawnPosition (int client_fd, int64_t x, int64_t y, int64_t z); int sc_startWaitingForChunks (int client_fd); int sc_playerAbilities (int client_fd, uint8_t flags); int sc_updateTime (int client_fd, uint64_t ticks); diff --git a/src/tools.c b/src/tools.c index 38ecd9b..a2f6e87 100644 --- a/src/tools.c +++ b/src/tools.c @@ -195,7 +195,7 @@ void clearPlayerFD (int client_fd) { } uint8_t serverSlotToClientSlot (uint8_t slot) { - if (slot >= 0 && slot < 9) return slot + 36; + if (slot < 9) return slot + 36; if (slot >= 9 && slot <= 35) return slot; if (slot == 40) return 45; if (slot >= 36 && slot <= 39) return 3 - (slot - 36) + 5; @@ -229,7 +229,7 @@ uint8_t clientSlotToServerSlot (int window_id, uint8_t slot) { // move furnace items to the player's crafting grid // this lets us put them back in the inventory once the window closes - if (slot >= 0 && slot <= 2) return 41 + slot; + if (slot <= 2) return 41 + slot; // the rest of the slots are identical, just shifted by 6 if (slot >= 3 && slot <= 38) return clientSlotToServerSlot(0, slot + 6);