package net.minestom.server.fluids;

import net.kyori.adventure.key.Key;
import net.kyori.adventure.key.Keyed;
import net.minestom.server.registry.Registries;
import net.minestom.server.utils.NamespaceID;

/**
 * //==============================
 * //  AUTOGENERATED BY EnumGenerator
 * //==============================
 */
@SuppressWarnings({"deprecation"})
public enum Fluid implements Keyed {
    EMPTY("minecraft:empty"),

    FLOWING_WATER("minecraft:flowing_water"),

    WATER("minecraft:water"),

    FLOWING_LAVA("minecraft:flowing_lava"),

    LAVA("minecraft:lava");

    private final String namespaceID;

    private final Key key;

    Fluid(String namespaceID) {
        this.namespaceID = namespaceID;
        Registries.fluids.put(NamespaceID.from(namespaceID), this);
        this.key = Key.key(this.namespaceID);
    }

    public int getId() {
        return ordinal();
    }

    public String getNamespaceID() {
        return namespaceID;
    }

    public Key key() {
        return this.key;
    }

    public static Fluid fromId(int id) {
        if (id >= 0 && id < values().length) {
            return values()[id];
        }
        return EMPTY;
    }
}
