net.minestom.server.item.MaterialImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minestom-snapshots Show documentation
Show all versions of minestom-snapshots Show documentation
1.20.4 Lightweight Minecraft server
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 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 values() {
return CONTAINER.values();
}
@Override
public String toString() {
return name();
}
}