Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propose interaction shapes data #832

Closed
wants to merge 1 commit into from

Conversation

zardoy
Copy link

@zardoy zardoy commented Jan 10, 2024

similar to #829 want to propose having interaction shapes which is essential for p web client and bot.cursorAtBlock to work correctly. As far as I remember its currently not possible to detect/break blocks like redstone wires with mineflayer.
I extracted interaction shapes of all interested blocks (with a few per-class manual fixes). It was much harder to extract using text manipulation since all blocks set these shapes differently and some like redstone calculate them at class initialization, I'm pretty sure it would be much easier to extract using them using other extractors, but I can't investigate it, sorry.

@zardoy
Copy link
Author

zardoy commented Jan 10, 2024

About the format. Item can be either:

  • single shape (0-16 values)
  • object with states e.g. with keys like north=side|up,.... use "" state if nothing matches
  • object with "combine" key e.g. redstone_wire or fire uses it to combine a few shapes

parser

The only known block that needs special shape calculation at runtime is light block.

@rom1504
Copy link
Member

rom1504 commented Jan 14, 2024

  1. this should be per version ; this is not data that is cross version
  2. what is missing from https://github.com/PrismarineJS/minecraft-data/blob/48589a6ad3276556a7ea38f219e079c4a7c9017e/data/pc/1.20/blockCollisionShapes.json and can the format be similar ?

@zardoy
Copy link
Author

zardoy commented Jan 14, 2024

  1. this should be per version ; this is not data that is cross version

yes, that's what I'm saying, I don't have a way to automatically extract it from any version. That included manual work, that's why I can propose data for the latest version only. I'm personally using it with any version with the block renames data without any problems so far.

btw Im just curious do any of these block shapes change over versions?

2. what is missing from 48589a6/data/pc/1.20/blockCollisionShapes.json and can the format be similar ?

this file is missing redstone wire for example since this includes collision shapes only, not cursor interaction. I'm pretty sure we can make the format compatible here if make it per version. On the other hand the collision block data format would be much easier to understand if it used the same per-state object format that is used in blockStates.json in mc assets e.g. key with properties - data (instead of an array of variation). Anyway, I can't make it compatible if this is the only requirement for now because of this.

I'm not doing the tool to make this file, that's what I have for now..

@wgaylord Also I believe we have discussed this as well, but I don't remember what you said about per-version extraction

@Gjum
Copy link
Member

Gjum commented Jan 16, 2024

Hi, creator of blockCollisionShapes.json here. That format was made to work with pre-flattening (numeric id:meta) identifiers; if there's a way to use the block[foo=bar] format with pre-flattening then that would be preferable for both collision and interaction shapes as it's much more human readable. And yes, collision (physics) and interaction (digging) shapes are different and need separate data files, and also change between versions (e.g. fences I think?).

@zardoy
Copy link
Author

zardoy commented Jan 16, 2024

I could guess the reason of the format, that's what I was saying - I dont think we need that format anymore. Also I wasn't saying that we don't need this data to be defined per version here, I'm just really curious wether this data was changed between version, and as I remember fence always had the same interaction shape.

And also I think that properties format still can work for pre-flattening versions in the same way as block states json from mc assets work for < 1.13

Anyway, thanks for your response here

@rom1504
Copy link
Member

rom1504 commented Jan 16, 2024 via email

@rom1504
Copy link
Member

rom1504 commented Jun 9, 2024

Stale, re open if you want to finish it

@rom1504 rom1504 closed this Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

3 participants