pyCraft icon indicating copy to clipboard operation
pyCraft copied to clipboard

placing or destroying blocks

Open TheHolyLoli opened this issue 6 years ago • 2 comments

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?

TheHolyLoli avatar Jun 23 '18 11:06 TheHolyLoli

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.

Hope this helps somewhat :)

zacholade avatar Jun 25 '18 14:06 zacholade

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!

AlexandrMilko avatar Jan 08 '21 20:01 AlexandrMilko