pyCraft
pyCraft copied to clipboard
placing or destroying blocks
i want to have block place/destroy feature.i dont know weather pycraft supports it or not but i am willing to do a pull request if it does not.the problem is that i dont know the packets required for this and i cant find them here.can anyone lighten me up?
The player block placement packet can be found here on the protocol wiki. It is implemented inside of networking/packets/serverbound/play. https://github.com/ammaraskar/pyCraft/blob/master/minecraft/networking/packets/serverbound/play/init.py#L148
For help with writing packets see: http://pycraft.readthedocs.io/en/latest/connecting.html#writing-packets
Currently, this library does not support block mapping (so your client does not know what block is where), however this doesn't mean you can't send a block placement packet to wherever your client is looking and control the direction your client is looking/standing using https://github.com/ammaraskar/pyCraft/blob/master/minecraft/networking/packets/serverbound/play/init.py#L67 Here is an idea of how to get the client to move https://github.com/ammaraskar/pyCraft/pull/84
I'm sure the maintainers would be happy with you trying to implement the following packets so that your client would be aware of what blocks are where.
- Chunk Data Packet
- Unload Chunk Packet however any implementation would need to support all protocol versions. help here
Hope this helps somewhat :)
OK, i've got block placement working. But, which packet should we use to destroy blocks? I tried BlockChangePacket, but i didn't get it working. Thanks!