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
902 B
Java
33 lines
902 B
Java
package net.minestom.server.item;
|
|
|
|
import net.minestom.server.registry.Registry;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import java.util.Collection;
|
|
|
|
record MaterialImpl(Registry.MaterialEntry registry) implements Material {
|
|
private static final Registry.Container<Material> CONTAINER = Registry.createStaticContainer(Registry.Resource.ITEMS,
|
|
(namespace, properties) -> new MaterialImpl(Registry.material(namespace, properties)));
|
|
|
|
static Material get(@NotNull String namespace) {
|
|
return CONTAINER.get(namespace);
|
|
}
|
|
|
|
static Material getSafe(@NotNull String namespace) {
|
|
return CONTAINER.getSafe(namespace);
|
|
}
|
|
|
|
static Material getId(int id) {
|
|
return CONTAINER.getId(id);
|
|
}
|
|
|
|
static Collection<Material> values() {
|
|
return CONTAINER.values();
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return name();
|
|
}
|
|
}
|