Skip to content

Conversation

@NotStirred
Copy link
Member

Previously a lectern redirected all pose information to its child book, which is different to the enchantment table. Likely because both lectern and book are entities

Main changes in this PR:

  • blocks and entities can return multiple entities on toEntity and fromJson respectively
  • lecterns are no longer poseable entities
  • lecterns now return both the lectern and its book as entities

As a result, lecterns don't show up in the entities list (as they shouldn't), and lectern books show up in the entities list

@leMaik leMaik changed the title Separate Lectern` and Book to match enchantment tables and its book Separate Lectern and Book to match enchantment tables and its book Jul 24, 2022
@leMaik
Copy link
Member

leMaik commented Jul 24, 2022

Lecterns are entities only because they are bigger than a block, i.e. they would be block entities. But then there's the book, which must be an entity (an actor) so that it can be posed.

Having a block entity and an entity at the same time would help, but I guess returning collections helps make this future-proof?

@NotStirred
Copy link
Member Author

Yeah that was my thinking, if you'd like me to implement it differently let me know

@leMaik leMaik self-assigned this Aug 30, 2025
@leMaik leMaik force-pushed the fix/lectern_contains_book branch from 6d69f85 to 5a0cd3e Compare August 30, 2025 16:35
@leMaik
Copy link
Member

leMaik commented Aug 30, 2025

@NotStirred I rebased this on top of master, maybe you could verify that this still does what you intended. 🚀

As a follow-up PR, we could add a button to create a book entity from a lectern, right now adding a lectern creates an empty lectern and not one with a book.

@leMaik
Copy link
Member

leMaik commented Aug 30, 2025

Should we rename the toEntity and isEntity methods to createEntities and hasEntities to make it more clear that a block may consist of multiple entities and that's why the methods return collections?

@NotStirred
Copy link
Member Author

Yeah that's probably better 👍

NotStirred and others added 4 commits August 31, 2025 15:19
Lecterns are no longer poseable
Lecterns now return both the lectern and its book.
…reate entities or block entities from blocks that don't support this.
…o clarify how entities and block entities work.
@leMaik leMaik force-pushed the fix/lectern_contains_book branch from 5a0cd3e to bf2f67e Compare August 31, 2025 13:53
@leMaik
Copy link
Member

leMaik commented Aug 31, 2025

Rebased, renamed methods and added more javadoc.

Having Entity::fromJson return multiple entities doesn't make sense now that I think about it. Since we create an entity per entity we already store them separately in the scene file, so loading an entity from there will always only produce a single entity per entity.

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.

2 participants