Minestom/src/main/java/net/minestom/server/item/EnchantmentImpl.java
iam 7320437640
Optionally load vanilla biomes (#1988)
* Add biomes from vanilla

* cleanup

* rework biomes

* nullability

* getByName string

* expose vanilla biomes

* not null

* before rename

* rename

* nbt cache

* fix

* fix

* fix

* final on vanilla biome
2024-02-12 15:25:46 -05:00

33 lines
939 B
Java

package net.minestom.server.item;
import net.minestom.server.registry.Registry;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
record EnchantmentImpl(Registry.EnchantmentEntry registry) implements Enchantment {
private static final Registry.Container<Enchantment> CONTAINER = Registry.createStaticContainer(Registry.Resource.ENCHANTMENTS,
(namespace, properties) -> new EnchantmentImpl(Registry.enchantment(namespace, properties)));
static Enchantment get(@NotNull String namespace) {
return CONTAINER.get(namespace);
}
static Enchantment getSafe(@NotNull String namespace) {
return CONTAINER.getSafe(namespace);
}
static Enchantment getId(int id) {
return CONTAINER.getId(id);
}
static Collection<Enchantment> values() {
return CONTAINER.values();
}
@Override
public String toString() {
return name();
}
}