JuliaBerry / PiCraft.jl

Manipulate Minecraft on the Raspberry Pi from Julia
https://juliaberry.github.io/PiCraft.jl/
Other
38 stars 11 forks source link

How to "track" block placement #46

Open Kevin-Mattheus-Moerman opened 2 years ago

Kevin-Mattheus-Moerman commented 2 years ago

Is it possible to detect when a block is placed? Is block placement an event that can be monitored?

I can see examples where block hitting with the sword can be recorded, this would allow one to keep track of a sculpting (block removal) activity.

However, I'm interested in creating 3D printable models using Minecraft on Raspberry Pi. It would be great to let kids build blocks and then export the model. I think all I need is to be able to track when a block is placed.

Thanks.

Ellipse0934 commented 2 years ago

Can you spawn a Task that periodically polls the positions of the required blocks ? i.e. Do a getBlock(x, y, z) compare with value in a Dict, if there is a change then push the update to a Channel or some queue like DataStructure.

I can't recall but I think you can get away with a couple of thousand API calls depending on the machine. If you are on the R-Pi maybe it's hundreds of calls a seconds..Polling isn't the same as an absolute guarantee but if a human is placing a block polling 2-3 times a second should be more than sufficient. I can write an example if it's helpful.

I'm interested in creating 3D printable models using Minecraft on Raspberry Pi

What kind of models are you looking to create ? I don't have any experience with 3D printing hence am unsure of how I can be of help. Right now if you know the coordinates of a the region you are looking to copy you can use copyModel to convert that into an Array{Block, 3} type. Then use a texture pack to generate a good 3-D model. It's obviously some work via the PiCraft.jl pipeline and you may be better served with external software that already exists for this task.