private final ExtraCodecs.LateBoundIdMapper<Identifier, MapCodec<? extends TimerCallback<C>>> idMapper = new ExtraCodecs.LateBoundIdMapper<>();
16
private final Codec<TimerCallback<C>> codec = this.idMapper.codec(Identifier.CODEC).dispatch(TimerCallback::codec, Function.identity());
17
18
public TimerCallbacks<C> register(final Identifier id, final MapCodec<? extends TimerCallback<C>> codec) {
19
this.idMapper.put(id, codec);
20
return this;
21
}
22
23
public Codec<TimerCallback<C>> codec() {
24
return this.codec;
25
}
26
}
27
Decompiled Minecraft 26.3 source of TimerCallbacks (net/minecraft/world/level/timers/TimerCallbacks.java) with Mojang official mappings, stored verbatim on the site.