Minecraft protocol implementation, provides parsing, serializing and chunk decompression.
Currently, Kyubu is separated into a few logical parts:
kyubu/cmd
- Whereprotocol_generator
et al livekyubu/format
- the Chat format, lifted from thinkofdeath/stevenkyubu/modern/minimal
- Minimal modern (1.8.3/47) packet definitions Enough for Kurafuto to function, but not everythingkyubu/packets
- packet parser/serializer stuff
Should you wish to actually use Kyubu (and I can't blame you, who wouldn't!),
you can extend the functionality of the parser easily by simply registering
additional packets with the parser (kyubu/packets.Register
).
For a working example, see kyubu/cmd/protocol_generatortest/test_proto.go
.
The general idea is this:
- Create a type that implements the
kyubu/packets.Packet
interface. - Add a
go generate
line to your file://go:generate protocol_generator -file=$GOFILE -direction=x -state=x -package=x
go get github.com/kurafuto/kurafuto/cmd/protocol_generator
to install it.
- Run
go generate
and ensure thex_proto.go
file looks like you expect. - Write some tests to ensure your packet works as intended (and preferably won't break existing packets!).
To save on time, rather than the old method of reflection, Kyubu now ships with
a custom go generate
-compatible command that makes your packet parser/serializer
cruft for you. Look at cmd/protocol_generator/test/test.go
for an example.
NOTE: It's heavily based off of the protocol_generator from thinkofdeath/steven.
Tests are shipped for kyubu/packets
, but as Kyubu is going through breaking
changes to work with Modern, it may not pass.
You can run them with the standard go test
in the above-mentioned packages.
If you make additions or revisions to the code, make sure the tests all pass, and
add any new tests for features/packets you've added.