`ComponentKey`s in component initializers may be registered too late
Pyrofab opened this issue ยท 1 comments
issue reported by ayupitsali on discord
When a ComponentKey
is registered like this :
public class ModComponents implements ScoreboardComponentInitializer {
public static final ComponentKey<PioneersDataComponent> PIONEERS_DATA = ComponentRegistry.getOrCreate(
new Identifier(Pioneers.MOD_ID, "pioneers_data"), PioneersDataComponent.class);
@Override
public void registerScoreboardComponentFactories(ScoreboardComponentFactoryRegistry registry) {
registry.registerScoreboardComponent(PIONEERS_DATA, (scoreboard, server) -> new PioneersDataComponent(scoreboard));
}
}
It will not actually be registered until the first scoreboard is created. When playing on dedicated servers, this may happen after the initial sync, causing the packet to get dropped. In V6, this may even cause the player to get disconnected (untested).