PlayerEntity ComponentProvider supplying same component for all players
Nosrick opened this issue ยท 4 comments
Hi again!
Hopefully I'm not being as dumb as last time, but I'm trying to implement 'claiming' functionality into my mod using components (that store the owner UUID and a hex code for their colour).
There are some strange behaviours that I've noticed:
- At world load, it creates two components: one for an unnamed ServerPlayerEntity, and one for an unnamed ClientPlayerEntity, each has different UUIDs. It does not create a component for any named player that joins the server.
- When I try to retrieve the component for a player, it always returns the same component, with the unnamed ServerPlayerEntity's UUID, and the colour that was set up for that. This persists between different players and I don't know why. Have I messed up registration somehow?
- This single component that is returned is created at world creation-ish time, and persists across every player that joins the server. It never changes.
Here's my repo for reproduction of the issue:
https://github.com/Nosrick/momcraft-fabric
I register my components in a class called "ModComponents" in dependency/cardinalcomponents.
I attempt to access my components in BlockResearchAltar, in the block package. I've tried several methods for accessing these components, and they all result in the same thing: a singular component being returned.
Hopefully I'm not being horrifically stupid!
EDIT: I'm using v2.4.2, btw.
Just did some testing on this:
The behaviour above only happens in a singleplayer world, regardless of which account is logged in.
On a dedicated server, it works as intended!
I'm not sure if this is intended behaviour?
At world load, it creates two components: one for an unnamed ServerPlayerEntity, and one for an unnamed ClientPlayerEntity
I think this is normal, when components are created the player has not been fully initialized yet.
This persists between different players and I don't know why
If you are talking about restarting the game multiple times, this is normal. You should notice your inventory gets preserved too when that happens.
Well, I will assume that this issue is just vanilla behaviour. If you have more info, feel free to reopen.