feat: add a modern, drop-in mcpi client package (#61) - #63
Merged
Conversation
Part of epic #61. Ships mcpi-client/, a standalone pip-installable `mcpi` package so existing Minecraft-Pi curriculum (Adventures in Minecraft, Raspberry Pi tutorials) runs unchanged against RaspberryJuice on Paper 26.2 - the fastest path to kids using this. It reproduces the classic API (from mcpi.minecraft import Minecraft; Minecraft.create(); mc.setBlock/getBlock/postToChat; mcpi.block/entity/vec3 constants; the *args + Vec3 flattening ergonomics), modernized to Python 3.9+, type-hinted, and tested. Command names target the current server registry (namespaced world.*/events.*), not the stale bundled strings. Its own connection carries over the classic drain() so a stray Fail from an unimplemented command can't desync the next query. Distribution name is raspberryjuice-mcpi (avoids the legacy PyPI `mcpi`); the import name stays `mcpi` so curriculum imports are unchanged. Pi-only commands RaspberryJuice never implemented (checkpoints, camera) are omitted; tokens aren't supported here (use the raspberryjuice client on a secured server). 25 tests on the FakeServer harness (wire-format + reply parsing + the drain guard + value objects); a new mcpi-test CI job; wheel builds clean.
This was referenced Aug 20, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First slice of epic #61 — a standalone, modern, pip-installable
mcpipackage so existing Minecraft-Pi curriculum runs unchanged against RaspberryJuice on current Minecraft (Paper 26.2 / Java 25).Summary
mcpi-client/package reproducing the classic API:from mcpi.minecraft import Minecraft; mc = Minecraft.create(),mc.setBlock/getBlock/getBlocks/getHeight/setSign/postToChat/spawnEntity/...,mc.player.*,mc.entity.*,mc.events.*, plusmcpi.block/mcpi.entityconstants,Vec3,Block,Entity.py.typed, tested. The classic*args+Vec3-flattening ergonomics are preserved (setBlock(x,y,z,id)andsetBlock(pos,id)both work); classic numeric block ids still work via the server's legacy-id bridge.world.spawnEntity,events.*,player.events.*), not the stale bundled strings. Its own connection carries over the classicdrain()so a strayFailfrom an unimplemented command can't desync the next query.raspberryjuice-mcpi(avoids the legacy PyPImcpi); the import name staysmcpi, so curriculum imports are unchanged.raspberryjuiceclient on a secured server).mcpi-testCI job runs the suite.Test plan
pytest mcpi-client— 25 tests pass on the FakeServer harness: block wire-format (incl.Vec3args + float-flooring), reply parsing (getBlock/getBlockWithData/getBlocks/getHeight), player pos/tile (ints vs floats), chat, entities (spawn/get/remove), event polls (chat/block/projectile + empty),RequestErroronFail, thedrain()stale-reply guard,setSigncomma/paren neutralizing, block constants,Vec3arithmetic, context-manager closepython -m build --wheelbuildsraspberryjuice_mcpi-0.1.0-py3-none-any.whlfrom mcpi.minecraft import Minecraft,from mcpi import block, entity,block.GOLD_BLOCK.id == 41Follow-ups (tracked in #61)
Live-run canonical Adventures in Minecraft snippets end-to-end; optional Pi-only stubs / token support if a need appears; PyPI publish (with #11).
https://claude.ai/code/session_01AcK3SgXRTVzAKBdPZw72sr