Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
de19981
aigen: chunks-spec v0.1
SkyVence Oct 8, 2025
e89df37
cpp version bump to c++23 to be aligned with the nbt lib
SkyVence Oct 8, 2025
cc3dbbd
updated doc
SkyVence Oct 8, 2025
40eeeae
header refactor
SkyVence Oct 8, 2025
67b51cd
merge player login fix
SkyVence Oct 8, 2025
f127026
fix import
SkyVence Oct 9, 2025
6798c61
merge fix play packet
SkyVence Oct 9, 2025
029c737
chore: project structure + pls fix my ocd issues
SkyVence Oct 9, 2025
67df7a0
feature: Reworking the config loader, added utils to get the executab…
SkyVence Oct 9, 2025
61452e8
fix: format action
SkyVence Oct 9, 2025
d75c92a
fix: formatting action
SkyVence Oct 9, 2025
5a85a0c
Apply clang-format [skip ci]
github-actions[bot] Oct 9, 2025
50dd697
feature: New config class, config loader, reloader. updated the serve…
SkyVence Oct 9, 2025
fec5b0d
Apply clang-format [skip ci]
github-actions[bot] Oct 9, 2025
ef75fff
feat: configuration changes
SkyVence Oct 9, 2025
5971b48
Apply clang-format [skip ci]
github-actions[bot] Oct 9, 2025
f026f64
fix: Now using getPath() to get the executable parent path
SkyVence Oct 10, 2025
fb7e0fa
Apply clang-format [skip ci]
github-actions[bot] Oct 10, 2025
e10f463
feat: Gzip decompress, can now load level.dat
SkyVence Oct 10, 2025
2c7bcff
merge: auto formatter commit
SkyVence Oct 10, 2025
4a76b85
feat: debug load level
SkyVence Oct 10, 2025
4ab9e6f
Apply clang-format [skip ci]
github-actions[bot] Oct 10, 2025
8eaa45b
feat: now make run cmd create a test-server folder
SkyVence Oct 10, 2025
cd6550c
refactor: now nbt related parsing now reside inside nbt namespace
SkyVence Oct 10, 2025
8019085
Apply clang-format [skip ci]
github-actions[bot] Oct 10, 2025
d960d2f
rebased
SkyVence Oct 10, 2025
97de556
Apply clang-format [skip ci]
github-actions[bot] Oct 10, 2025
5f37981
feat: chunk loading via chunk coord, data-generator submodule (see us…
SkyVence Oct 10, 2025
9aeb360
Apply clang-format [skip ci]
github-actions[bot] Oct 10, 2025
6cc0811
sub
SkyVence Oct 11, 2025
f4aae51
Merge remote-tracking branch 'refs/remotes/origin/skyvence/chunks' in…
SkyVence Oct 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
BasedOnStyle: LLVM
IndentWidth: 4 # logical indent level = 1 tab
TabWidth: 4 # how wide a tab renders (adjust per team preference)
UseTab: ForIndentation # use tabs for indentation, spaces for alignment
UseTab: Always # use tabs for indentation, spaces for alignment
ContinuationIndentWidth: 8
BreakBeforeBraces: Attach
ColumnLimit: 100
ColumnLimit: 150
AllowShortIfStatementsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
PointerAlignment: Left
SpaceBeforeParens: ControlStatements
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveDeclarations: None
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
BinPackArguments: false
BinPackParameters: false
Cpp11BracedListStyle: true
Expand Down
2 changes: 1 addition & 1 deletion .clangd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CompileFlags:
Add:
- "-std=c++17"
- "-std=c++23"
- "-Wall"
- "-Wextra"
- "-Wpedantic"
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: clang-format

on:
push:
pull_request:

jobs:
clang-format:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format

- name: Run clang-format
run: |
find . -name '*.cpp' -o -name '*.h' -o -name '*.c' -o -name '*.hpp' -o -name '*.cc' -o -name '*.cxx' \
| grep -v "include/lib/json.hpp" \
| xargs clang-format -i --style=file

- name: Commit and push changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

if ! git diff --quiet; then
git add -A
git commit -m "Apply clang-format [skip ci]"
git push
echo "Code formatted and pushed"
else
echo "No formatting changes needed"
fi
17 changes: 0 additions & 17 deletions .github/workflows/verif-build.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ compile_commands.json
.cache
.vscode
logs

# Test server directory
test-server
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "data-generator"]
path = data-generator
url = https://github.com/Random-stuff-unlimited/data-generator.git
44 changes: 38 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ INCLUDE_FLAGS := -I$(INCLUDE_DIR)

# Linker flags (add your libraries here)
LDFLAGS :=
LIBS :=
LIBS := -lz

# ================================ COLOR SETUP ===============================
# ANSI color codes for beautiful output
Expand Down Expand Up @@ -82,7 +82,7 @@ else
endif

# ================================= TARGETS ==================================
.PHONY: all clean debug release info help run install uninstall compile_commands
.PHONY: all clean distclean clean-test debug release info help run install uninstall compile_commands

# Default target
all: info $(TARGET)
Expand Down Expand Up @@ -129,14 +129,44 @@ $(DEPS_DIR):
# Clean build artifacts
clean:
@printf "$(BOLD)$(BRIGHT_RED)🧹 Cleaning build artifacts...$(RESET)\n"
@find $(BUILD_DIR) -type f -name "*.o" -delete 2>/dev/null || true
@find $(BUILD_DIR) -name "$(TARGET_NAME)" -delete 2>/dev/null || true
@find $(BUILD_DIR) -type d -empty -delete 2>/dev/null || true
@find $(DEPS_DIR) -type f -name "*.d" -delete 2>/dev/null || true
@find $(DEPS_DIR) -type d -empty -delete 2>/dev/null || true
@printf "$(BOLD)$(BRIGHT_GREEN)✨ Clean completed! (Preserved directories and config.json)$(RESET)\n"

# Complete clean - removes everything including directories
distclean:
@printf "$(BOLD)$(BRIGHT_RED)🧹 Complete cleanup (removing all build artifacts and directories)...$(RESET)\n"
@rm -rf $(BUILD_DIR) $(DEPS_DIR)
@printf "$(BOLD)$(BRIGHT_GREEN)✨ Clean completed!$(RESET)\n"
@printf "$(BOLD)$(BRIGHT_GREEN)✨ Complete cleanup finished!$(RESET)\n"

# Clean test-server directory
clean-test:
@printf "$(BOLD)$(BRIGHT_RED)🧹 Cleaning test-server directory...$(RESET)\n"
@rm -rf test-server
@printf "$(BOLD)$(BRIGHT_GREEN)✨ Test-server cleanup finished!$(RESET)\n"

# Run the executable
run: $(TARGET)
@printf "$(BOLD)$(BRIGHT_MAGENTA)🚀 Setting up test-server environment...$(RESET)\n"
@mkdir -p test-server
@printf "$(BOLD)$(BRIGHT_BLUE)📦 Copying executable to test-server...$(RESET)\n"
@cp $(TARGET) test-server/$(TARGET_NAME)
@printf "$(BOLD)$(BRIGHT_BLUE)📦 Copying config.json to test-server...$(RESET)\n"
@cp -f config.json test-server/ 2>/dev/null || printf "$(YELLOW)⚠️ config.json not found, skipping...$(RESET)\n"
@printf "$(BOLD)$(BRIGHT_BLUE)📦 Copying world folder to test-server...$(RESET)\n"
@if [ -d "world" ]; then \
cp -r world test-server/; \
printf "$(BOLD)$(BRIGHT_GREEN)✅ World folder copied successfully!$(RESET)\n"; \
else \
printf "$(YELLOW)⚠️ World folder not found, skipping...$(RESET)\n"; \
fi
@printf "$(BOLD)$(BRIGHT_GREEN)✅ Test environment ready!$(RESET)\n"
@printf "$(BOLD)$(BRIGHT_MAGENTA)🚀 Running $(TARGET_NAME)...$(RESET)\n"
@printf "$(DIM)$(WHITE)" && echo "================================================" && printf "$(RESET)"
@./$(TARGET)
@cd test-server && ./$(TARGET_NAME)
@printf "$(DIM)$(WHITE)" && echo "================================================" && printf "$(RESET)"

# Display project information
Expand Down Expand Up @@ -190,8 +220,10 @@ help:
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "all" "Build the project (default: release mode)"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "debug" "Build in debug mode"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "release" "Build in release mode"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "clean" "Remove all build artifacts"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "run" "Build and run the executable"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "clean" "Remove build artifacts (preserve dirs)"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "distclean" "Remove all build artifacts and dirs"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "clean-test" "Remove test-server directory"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "run" "Setup test-server and run executable"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "compile_commands" "Generate compile_commands.json for LSP"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "install" "Install the executable to system"
@printf "$(BOLD)$(BRIGHT_CYAN)║$(RESET) $(BRIGHT_GREEN)%-10s$(RESET) %-39s $(BOLD)$(BRIGHT_CYAN) ║$(RESET)\n" "uninstall" "Remove the executable from system"
Expand Down
25 changes: 15 additions & 10 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"version": {
"name": "1.21.5",
"protocol": 770
},
"server": {
"ip-address": "127.0.0.1",
"port": 25565,
"motd": "§aServeur Minecraft en C!",
"max-players": 20
}
"version": {
"name": "1.21.5",
"protocol": 770
},
"server": {
"ip-address": "127.0.0.1",
"port": 25565,
"motd": "§aServeur Minecraft en C!",
"max-players": 20
},
"world": {
"name": "world",
"gamemode": "survival",
"difficulty": "normal"
}
}
1 change: 1 addition & 0 deletions data-generator
Submodule data-generator added at ab45d3
33 changes: 0 additions & 33 deletions ideas/console-log.md

This file was deleted.

50 changes: 0 additions & 50 deletions include/buffer.hpp

This file was deleted.

53 changes: 53 additions & 0 deletions include/config.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#ifndef CONFIG_HPP
#define CONFIG_HPP

#include <filesystem>
#include <string>

class Config {
private:
std::filesystem::path _execPath;

// Version Config
std::string _gameVersion;
int _protocolVersion;

// Server Config
std::string _serverMotd;
std::string _serverAddress;
int _serverPort;
int _serverSize;

// World Config
std::string _worldName;
std::string _gamemode;
std::string _difficulty;

public:
Config();
~Config();
bool loadConfig();
bool reloadConfig();

int getServerPort();
int getProtocolVersion();
int getServerSize();
std::string getVersion();
std::string getServerMotd();
std::string getServerAddress();
std::string getWorldName();
std::string getGamemode();
std::string getDifficulty();

void setProtocolVersion(int ProtoVersion);
void setServerSize(int ServerSize);
void setServerPort(int ServerPort);
void setServerMotd(std::string ServerMotd);
void setServerVersion(std::string ServerVersion);
void setServerAddress(std::string ServerAddress);
void setWorldName(std::string WorldName);
void setGamemode(std::string Gamemode);
void setDifficulty(std::string Difficulty);
};

#endif
File renamed without changes.
8 changes: 4 additions & 4 deletions include/UUID.hpp → include/lib/UUID.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class UUID {

uint64_t getMostSigBits() const;
uint64_t getLeastSigBits() const;
void setMostSigBits(uint64_t val);
void setLeastSigBits(uint64_t val);
void setMostSigBits(uint64_t val);
void setLeastSigBits(uint64_t val);

std::string toString() const;

void readFromBuffer(Buffer& buf);
void writeToBuffer(Buffer& buf) const;
void readFromBuffer(Buffer& buf);
void writeToBuffer(Buffer& buf) const;
static UUID fromOfflinePlayer(const std::string& name);
};

Expand Down
8 changes: 8 additions & 0 deletions include/lib/filesystem.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef FS_H
#define FS_H

#include <filesystem>

std::filesystem::path getPath();

#endif
File renamed without changes.
Loading