Minestom / Minestom

1.21 Lightweight Minecraft server
https://minestom.net
Apache License 2.0
2.38k stars 382 forks source link

ViewEngine passenger bug #2081

Open MelonHell opened 5 months ago

MelonHell commented 5 months ago

I have a player who has invisibility player.isAutoViewable = false The player has an entity on his head (passenger) that only that player should see After the player comes out of invisibility player.isAutoViewable = true the entity also becomes visible but should not

The current implementation of ViewEngine is terrible. It works extremely unpredictably and has many bugs. I think it needs a complete rework. For example, I cannot use ViewEngine for custom objects that do not implements Entity

DeidaraMC commented 4 months ago

Could you share more of the unpredictability and "many bugs" you've come across with the view engine? It would help give us more of a push to justify a rewrite

MelonHell commented 4 months ago

It will be difficult for me to name specific bugs, but I have often had cases when something is shown, although it is hidden and vice versa. There is definitely a problem with passengers; they are almost always processed incorrectly. I would also like to be able to use ViewAPI more flexibly, for example, I use models consisting of several entities and it would be convenient if ViewAPI could accept not only Entities, but also a custom Model class that would proxy calls to all entities at once

MelonHell commented 4 months ago

Also, this part seems very dirty to me. I don't think this code should be in Player. I think ViewAPI should have a separate method for something like this https://github.com/Minestom/Minestom/blob/5c23713c03552c378a77e1f3f8a8046dfe8e1f84/src/main/java/net/minestom/server/entity/Player.java#L537-L543