GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - anbcodes/cmc: cmc is a work-in-progress Minecraft client written in C. It currently supports joining servers with compression, encryption, and authenticated login.

BranchesTags
Open more actions menu

Latest commit

 

History

93 Commits
93 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.clang-format
.clang-format
 
 
.clangd
.clangd
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
README.md
README.md
 
 
block_outline.wgsl
block_outline.wgsl
 
 
custommc.sh
custommc.sh
 
 
dev-setup.sh
dev-setup.sh
 
 
entity.wgsl
entity.wgsl
 
 
extractPacketIDs.js
extractPacketIDs.js
 
 
import-data.sh
import-data.sh
 
 
shader.wgsl
shader.wgsl
 
 
sky.wgsl
sky.wgsl
 
 
texture-2.png
texture-2.png
 
 

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

  • mkdir lib
  • Download the prebuilt WGPU libraries from https://github.com/gfx-rs/wgpu-native/releases and put the extracted zip in the lib/wgpu directory
  • Download the GLFW sources into lib/glfw from the version pointed to from https://github.com/gfx-rs/wgpu-native/tree/trunk/examples/vendor
  • From the main directory, run git clone https://github.com/recp/cglm.git -o ./lib/cglm to get cglm. It works as a header-only library.
  • Retrieve blocks.json from the server jar with the following and place it in /data.
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

  • framework.h and framework.c are from https://github.com/gfx-rs/wgpu-native/tree/trunk/examples/framework
  • main.c and shader.wsgl are from https://github.com/gfx-rs/wgpu-native/tree/trunk/examples/triangle
  • In main.c I updated the includes to their local locations:
#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

Readme
Activity

Stars

2 stars

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.