Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 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
32cdfd7
feat: added registry packet
SkyVence Oct 12, 2025
bd379c3
Apply clang-format [skip ci]
github-actions[bot] Oct 12, 2025
66f6c4a
submodule: data-generator
delmath Oct 12, 2025
9585b77
Apply clang-format [skip ci]
github-actions[bot] Oct 12, 2025
bdc8278
Pulled submodule to latest
SkyVence Oct 12, 2025
3e2b828
Merge remote-tracking branch 'refs/remotes/origin/skyvence/chunks' in…
SkyVence Oct 12, 2025
15ad7ad
fix: registries
delmath Oct 12, 2025
4d181b4
Apply clang-format [skip ci]
github-actions[bot] Oct 12, 2025
4c6988d
tmp
delmath Oct 12, 2025
5aae233
Merge remote-tracking branch 'refs/remotes/origin/skyvence/chunks' in…
delmath Oct 12, 2025
970da1c
Apply clang-format [skip ci]
github-actions[bot] Oct 12, 2025
8959438
clean: clean dead code
delmath Oct 13, 2025
b33a465
Apply clang-format [skip ci]
github-actions[bot] Oct 13, 2025
89ea017
fix: remove dialog tag
delmath Oct 13, 2025
60f3257
Merge remote-tracking branch 'refs/remotes/origin/skyvence/chunks' in…
delmath Oct 13, 2025
d1fa2ba
Apply clang-format [skip ci]
github-actions[bot] Oct 13, 2025
9629c2c
rm: remove dialog tag
delmath Oct 13, 2025
9f56e23
Merge remote-tracking branch 'refs/remotes/origin/skyvence/chunks' in…
delmath Oct 13, 2025
d66f20d
Apply clang-format [skip ci]
github-actions[bot] Oct 13, 2025
f5b3968
refactor: moved around packet function for clientbound and serverbound
SkyVence Oct 14, 2025
2936f04
fix: make error
delmath Oct 14, 2025
4c6215d
zed rules
SkyVence Oct 14, 2025
f89a6f6
Apply clang-format [skip ci]
github-actions[bot] Oct 14, 2025
e35c0f1
we missed a packet and the packet we missed doesnt work
SkyVence Oct 14, 2025
966b5da
Merge remote-tracking branch 'refs/remotes/origin/skyvence/chunks' in…
SkyVence Oct 14, 2025
7368041
feat: serverbound known packs
SkyVence Oct 14, 2025
246bbaf
wip: remaking registryData packet
SkyVence Oct 14, 2025
7b391fe
add: add serverboun known packs
delmath Oct 14, 2025
258eb30
Merge remote-tracking branch 'refs/remotes/origin/skyvence/chunks' in…
SkyVence Oct 14, 2025
43c0d3b
rename: packs file
delmath Oct 14, 2025
6ccedc8
Apply clang-format [skip ci]
github-actions[bot] Oct 14, 2025
32cb264
disabled formatting
SkyVence Oct 14, 2025
200d3b9
Merge remote-tracking branch 'refs/remotes/origin/skyvence/chunks' in…
SkyVence Oct 14, 2025
ce8c59a
fix: packet play
delmath Oct 14, 2025
1b04387
Merge remote-tracking branch 'refs/remotes/origin/skyvence/chunks' in…
delmath Oct 14, 2025
e677663
chunk: added queryer
SkyVence Oct 14, 2025
5ae73a1
fixed
SkyVence Oct 14, 2025
8e70ff8
??
SkyVence Oct 14, 2025
3bec3dc
fix: login (play) packet
delmath Oct 14, 2025
395d1c1
add: game event package
delmath Oct 14, 2025
db6906e
removed non-needed folder
SkyVence Oct 14, 2025
7466571
update: chunck packet
delmath Oct 14, 2025
e4efd4b
Merge remote-tracking branch 'refs/remotes/origin/skyvence/chunks' in…
delmath Oct 14, 2025
5e3e7e4
disabled LevelChunkWithLight packet, added optional packet changeDiff…
SkyVence Oct 15, 2025
e0afc33
Added template clientboundpacket
SkyVence Oct 15, 2025
ab40d0f
Added playerAbilities packet, currently set to Creative Mode, default…
SkyVence Oct 15, 2025
d6546b9
Added setHeldItem, currently set to 4th slots in the item bar
SkyVence Oct 15, 2025
835a699
Merge: Fixed merge conflict between main and skyvence/chunks, still b…
SkyVence Oct 15, 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.

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

# Test server directory
test-server
include/external
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external/data-generator"]
path = external/data-generator
url = https://github.com/Random-stuff-unlimited/data-generator.git
5 changes: 5 additions & 0 deletions .rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
1. Do not create markdown documentation.
2. When creating code from scratch you should always make sure the code does work before reitering.
3. When working on complex feature you always should ask for direction on data type the user might need.
4. If you think a library header is needed to go futher stop and ask user. You can recommand a library.
5. If not asked do not modify any code in any way.
46 changes: 39 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ CXX := g++
CXXFLAGS := -std=c++20 -Wall -Wextra -Wpedantic -O2
DEBUG_FLAGS := -g -DDEBUG -O0
RELEASE_FLAGS := -DNDEBUG -O3
INCLUDE_FLAGS := -I$(INCLUDE_DIR)
INCLUDE_FLAGS := -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/data -I$(INCLUDE_DIR)/network -I$(INCLUDE_DIR)/world -I$(INCLUDE_DIR)/lib

# 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 external/data-generator
Submodule data-generator added at 45d764
33 changes: 0 additions & 33 deletions ideas/console-log.md

This file was deleted.

51 changes: 0 additions & 51 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
Loading