Minestom/src/main/java/net/minestom/server/item/Enchantment.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

48 lines
1.3 KiB
Java

package net.minestom.server.item;
import net.minestom.server.registry.StaticProtocolObject;
import net.minestom.server.registry.Registry;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
public sealed interface Enchantment extends StaticProtocolObject, Enchantments permits EnchantmentImpl {
/**
* Returns the enchantment registry.
*
* @return the enchantment registry
*/
@Contract(pure = true)
@NotNull Registry.EnchantmentEntry registry();
@Override
default @NotNull NamespaceID namespace() {
return registry().namespace();
}
@Override
default int id() {
return registry().id();
}
static @NotNull Collection<@NotNull Enchantment> values() {
return EnchantmentImpl.values();
}
static @Nullable Enchantment fromNamespaceId(@NotNull String namespaceID) {
return EnchantmentImpl.getSafe(namespaceID);
}
static @Nullable Enchantment fromNamespaceId(@NotNull NamespaceID namespaceID) {
return fromNamespaceId(namespaceID.asString());
}
static @Nullable Enchantment fromId(int id) {
return EnchantmentImpl.getId(id);
}
}