Skip to content

Implement proper item display interactions - #916

Open
Seggan wants to merge 25 commits into
masterfrom
seggan/feature/bvh
Open

Seggan wants to merge 25 commits into
masterfrom
seggan/feature/bvh

Conversation

@Seggan

@Seggan Seggan commented Sep 30, 2026

Copy link
Copy Markdown
Member

By assuming an item display is a 1x1x1 cube, intersection checks can be successfully performed no matter the transformation of the entity.

This is actually a very small part of the PR, the majority of the code is focused on making said checks fast. Testing has given about 400 μs on a 1000-item random tree and 1 ms on a 10000-item random tree. Random trees are the worst case for this kind of thing, I expect real world perf to be better.

I have switched wiring, electric ports, and fluid endpoints to this system, and tested all. This also solves pretty much every issue with wiring (there are/were a lot lol).

This also enables a lot for us, for example an interactive in-world assembly table or smth, or WAILA for display entities.

Resolves #913.

@Seggan
Seggan requested a review from a team September 30, 2026 19:58

@JustAHuman-xD JustAHuman-xD left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quickish review from my phone, I'll try to do a more in depth one later

Comment on lines +618 to +619
data class Block(val block: org.bukkit.block.Block, override val location: Location) : PlayerTarget
data class Entity(val entity: org.bukkit.entity.Entity, override val location: Location) : PlayerTarget

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't love the name collision

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do u suggest they be named instead? realistically theyre always gonna be referenced as PlayerTarget.Block, etc outside of this interface

Comment on lines +7 to +10
/**
* A [BVH tree](https://en.wikipedia.org/wiki/Bounding_volume_hierarchy) storing exactly two children per node.
* This gives a sublinear intersection testing complexity, with best-case O(log2 n) and worst-case O(n).
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this a thing? isn't this just a binary tree? such structures should already exist in the java lib, if this is really needed can you add more docs about it here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read the wikipedia page pls 🙏

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unbreakable wire hub Unable to use output on portable tanks Use proper AABB interactions for display interations

3 participants