Skip to content
/ cmc Public

cmc is a work-in-progress Minecraft client written in C. It currently supports joining servers with compression, encryption, and authenticated login.

Notifications You must be signed in to change notification settings

anbcodes/cmc

Repository files navigation

cmc

TODO

  • Optimize create_chunk_and_light_data_packet
  • Optimize chunk_section_update_mesh

cmc-1

Project setup

Debian Linux

If you are on debian linux run ./dev-setup.sh and ./import-data.sh.

To build run

  • mkdir build && cd build
  • cmake ..
  • cd ..
  • cmake --build build -j8

To run

  • Create a Minecraft profile and set a custom Java executable to the path of custommc.sh
  • Run that Minecraft profile which creates a file called ./run-with-token.sh
  • Edit that file to change the server hostname and port.
  • Run ./run-with-token.sh

To run with a local server online mode turned off (the final two args are unused auth placeholders)

  • ./build/cmc <any-username> <host> <port> _ _

Generic instructions

java -DbundlerMainClass=net.minecraft.data.Main -jar paper-1.20.6-145.jar --reports
  • To load default client resources, copy your client jar from ~/.minecraft/versions to /data and extract it with gunzip 1.20.6.jar. To clean things up you can rm *.class as these files are not needed.
  • To compile and run follow the instructions above

Features

  • Offline and online mode support
  • Encryption support
  • Basic rendering
  • Building and breaking blocks
  • Player movement

Debugging

If there is a core dump:

coredumpctl dump -r `pwd`/a.out > core && gdb a.out -c core

Notes on how I got started with a WebGPU example in C

#include "wgpu/webgpu.h"
#include "wgpu/wgpu.h"
// ...
#include "GLFW/include/GLFW/glfw3.h"
#include "GLFW/include/GLFW/glfw3native.h"
  • I added
#define GLFW_EXPOSE_NATIVE_WAYLAND
#define GLFW_EXPOSE_NATIVE_X11

before

#include "GLFW/include/GLFW/glfw3.h"
  • I commented out this line that causes an error (probably a mismatched wgpu version)
//  .depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,

To figure out which texture keys there are in model files:

jq -r '.textures | keys[]' block/*.json | sort | uniq -c | sort -nr

About

cmc is a work-in-progress Minecraft client written in C. It currently supports joining servers with compression, encryption, and authenticated login.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages