Conversation
jdeast
added a commit
to jdeast/pyncraft
that referenced
this pull request
Sep 7, 2026
Closes #5, #6, #7, #8, #9, #10, #11, #12, #13, #14. #5 MinecraftTurtle could not be constructed at all. __init__ set the pen and turtle blocks to material name strings but _drawTurtle read .id and .data off them, which is the pre-1.13 Block API, and the last line of __init__ calls _drawTurtle -- so the class raised AttributeError on construction and had been unreachable since the flattening. It now uses names throughout. Also passes z rather than y twice when drawing itself, takes a Block object in penblock() for old code, and defaults position to None instead of a shared mutable Vec3(0,0,0). #6 Block raised TypeError on both hash() and repr(), because __hash__ did (id << 8) + data and __repr__ used %d, on ids that are now material names. __cmp__ has not existed since Python 2, so sorting raised too. #7 MinecraftDrawing passed blockData as setBlock's fifth positional argument, which since the flattening is the block's FACING. Every directional block -- stairs, furnaces, chests, doors, beds, torches -- silently failed to place and left a stray Fail in the stream. drawPoint3d and MinecraftShape.draw no longer forward it; the parameter stays so old calls still work. #8 getLine bitshifts its deltas, so float coordinates raised TypeError -- and player.getPos() returns floats, making the most natural call the broken one. Now floors first. Upstream has had this fix open since 2013: martinohanlon/minecraft-stuff#1, whose author hit it exactly this way. We use math.floor rather than his int(), which truncates toward zero and puts negative coordinates in the wrong block. #9 drain() decoded as cp437, but FruitJuice reads and writes the socket as UTF-8 and util encodes UTF-8 on the way out. Same bug upstream: martinohanlon/mcpi#27, attempted in mcpi#31. #10 receive() built a new makefile() per call, each with its own buffer, so two replies arriving in one TCP segment meant the second was buffered and then thrown away with the reader. One file object for the connection now. #11 SHOW_DEBUG and SHOW_Log defaulted to True, so importing and connecting printed ANSI-coloured text to stdout. Off by default; the old name still works. #12 receive() returned "" when the server hung up, which does not start with "Fail" and so was handed back as an ordinary answer. Raises ConnectionClosed. #13 ArrowHitEvent.__repr__ announced itself as BlockEvent. #14 46 tests covering coordinates, the wire protocol against a fake socket, and the drawing helpers. Every case is a bug that shipped. They now gate the release: the publish workflow runs them before building, and the smoke check on the built wheel imports minecraftstuff and block, which is what would have caught 0.2.2 shipping without minecraftstuff.py. Writing the tests turned up one more: a str is Iterable, so Coord("x", 2, 3) took the sequence branch and complained about the number of coordinates rather than the type. All verified against a live 1.20 server: the turtle constructs and leaves a trail, drawLine places stairs, Block hashes and sorts, getLine takes floats. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kq1Cjkh3bVT1WLzh5FRVQG
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.
Hi Martin,
I started playing with your code and because I was using getPos not getTilePos I was getting conversion exceptions. I thought it would be an improvement to force all args to ints so it didn't matter which was used.
Cheers,
Matt