Tnze / go-mc

Collection of Go libraries for Minecraft
https://go-mc.github.io/tutorial/
MIT License
858 stars 115 forks source link

How to get the type, state and content of a block/entity. #242

Closed Paradist closed 1 year ago

Paradist commented 1 year ago

Say how this can be done or add functionality, please:

I when updating a chunk get all the blocks, sift by type (for example pictures or frames) and get if a picture is an image(in []byte or something else), if a frame and if a picture is in it - also in []byte or something else.

So far my progress stopped at getting the number of blocks and their number in a chunk. From stateId I could not find how to get type and other information.

Please help!

Tnze commented 1 year ago

Didn't understand what do you want yet (picture is image etc.)

But if you got a state id now, probably you want to use it as an index of block.StateList next.

Paradist commented 1 year ago

I want to get an image in some format (like []bytes or something similar, which can then be saved as a .png/.jpg image) from a map and their coordinates in format (x y z).

Tnze commented 1 year ago

So can you access the full save files?

maxsupermanhd commented 1 year ago

I want to get an image in some format from a map and their coordinates in format (x y z).

https://github.com/maxsupermanhd/WebChunk

Paradist commented 1 year ago

Hmm, I'll write more, I need to save "Frame Captcha" in .png/.jpg. For the normal(manual) is rarely used (And by the way, how do I get it out and save it too?).

I can't enter almost anywhere this way, because "Frame Captcha" is used almost everywhere.

Tnze commented 1 year ago

I got it, you are developing a bot, receiving the map from the server. You may want to handle Map_Data packet.

https://minecraft.fandom.com/wiki/Map_item_format https://pkg.go.dev/github.com/Tnze/go-mc/bot#Events.AddListener https://go-mc.github.io/tutorial/network/index.html