mirror of
https://github.com/Minestom/Minestom.git
synced 2024-06-25 05:54:53 +02:00
* 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
33 lines
939 B
Java
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();
|
|
}
|
|
}
|