mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-12 19:30:42 +01:00
Inline registry loading
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
615476fe53
commit
eb3c894971
@ -8,10 +8,7 @@ import java.util.Collection;
|
||||
|
||||
record ParticleImpl(NamespaceID namespace, int id) implements Particle {
|
||||
private static final Registry.Container<Particle> CONTAINER = Registry.createContainer(Registry.Resource.PARTICLES,
|
||||
(namespace, object) -> {
|
||||
final int id = ((Number) object.get("id")).intValue();
|
||||
return new ParticleImpl(NamespaceID.from(namespace), id);
|
||||
});
|
||||
(namespace, object) -> new ParticleImpl(NamespaceID.from(namespace), ((Number) object.get("id")).intValue()));
|
||||
|
||||
static Particle get(@NotNull String namespace) {
|
||||
return CONTAINER.get(namespace);
|
||||
|
@ -8,10 +8,7 @@ import java.util.Collection;
|
||||
|
||||
record PotionTypeImpl(NamespaceID namespace, int id) implements PotionType {
|
||||
private static final Registry.Container<PotionType> CONTAINER = Registry.createContainer(Registry.Resource.POTION_TYPES,
|
||||
(namespace, object) -> {
|
||||
final int id = ((Number) object.get("id")).intValue();
|
||||
return new PotionTypeImpl(NamespaceID.from(namespace), id);
|
||||
});
|
||||
(namespace, object) -> new PotionTypeImpl(NamespaceID.from(namespace), ((Number) object.get("id")).intValue()));
|
||||
|
||||
static PotionType get(@NotNull String namespace) {
|
||||
return CONTAINER.get(namespace);
|
||||
|
@ -8,10 +8,7 @@ import java.util.Collection;
|
||||
|
||||
record SoundEventImpl(NamespaceID namespace, int id) implements SoundEvent {
|
||||
private static final Registry.Container<SoundEvent> CONTAINER = Registry.createContainer(Registry.Resource.SOUNDS,
|
||||
(namespace, object) -> {
|
||||
final int id = ((Number) object.get("id")).intValue();
|
||||
return new SoundEventImpl(NamespaceID.from(namespace), id);
|
||||
});
|
||||
(namespace, object) -> new SoundEventImpl(NamespaceID.from(namespace), ((Number) object.get("id")).intValue()));
|
||||
|
||||
static SoundEvent get(@NotNull String namespace) {
|
||||
return CONTAINER.get(namespace);
|
||||
|
@ -8,10 +8,7 @@ import java.util.Collection;
|
||||
|
||||
record StatisticTypeImpl(NamespaceID namespace, int id) implements StatisticType {
|
||||
private static final Registry.Container<StatisticType> CONTAINER = Registry.createContainer(Registry.Resource.STATISTICS,
|
||||
(namespace, object) -> {
|
||||
final int id = ((Number) object.get("id")).intValue();
|
||||
return new StatisticTypeImpl(NamespaceID.from(namespace), id);
|
||||
});
|
||||
(namespace, object) -> new StatisticTypeImpl(NamespaceID.from(namespace), ((Number) object.get("id")).intValue()));
|
||||
|
||||
static StatisticType get(@NotNull String namespace) {
|
||||
return CONTAINER.get(namespace);
|
||||
|
Loading…
Reference in New Issue
Block a user