diff --git a/paper-api/src/main/java/org/bukkit/Fluid.java b/paper-api/src/main/java/org/bukkit/Fluid.java new file mode 100644 index 0000000000..525ede4213 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/Fluid.java @@ -0,0 +1,24 @@ +package org.bukkit; + +import java.util.Locale; +import org.jetbrains.annotations.NotNull; + +public enum Fluid implements Keyed { + + WATER, + FLOWING_WATER, + LAVA, + FLOWING_LAVA; + + private final NamespacedKey key; + + private Fluid() { + this.key = NamespacedKey.minecraft(this.name().toLowerCase(Locale.ROOT)); + } + + @NotNull + @Override + public NamespacedKey getKey() { + return key; + } +} diff --git a/paper-api/src/main/java/org/bukkit/Registry.java b/paper-api/src/main/java/org/bukkit/Registry.java index 91544ade41..d3f346413e 100644 --- a/paper-api/src/main/java/org/bukkit/Registry.java +++ b/paper-api/src/main/java/org/bukkit/Registry.java @@ -158,6 +158,12 @@ public interface Registry extends Iterable { return MemoryKey.getByKey(key); } }; + /** + * Server fluids. + * + * @see Fluid + */ + Registry FLUID = new SimpleRegistry<>(Fluid.class); /** * Get the object by its key. diff --git a/paper-api/src/main/java/org/bukkit/Tag.java b/paper-api/src/main/java/org/bukkit/Tag.java index 8ad4bd9ac9..aacbfadc91 100644 --- a/paper-api/src/main/java/org/bukkit/Tag.java +++ b/paper-api/src/main/java/org/bukkit/Tag.java @@ -409,6 +409,18 @@ public interface Tag extends Keyed { * Vanilla item tag representing all furnace materials. */ Tag ITEMS_FURNACE_MATERIALS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("furnace_materials"), Material.class); + /** + * Key for the built in fluid registry. + */ + String REGISTRY_FLUIDS = "fluids"; + /** + * Vanilla fluid tag representing lava and flowing lava. + */ + Tag FLUIDS_LAVA = Bukkit.getTag(REGISTRY_FLUIDS, NamespacedKey.minecraft("lava"), Fluid.class); + /** + * Vanilla fluid tag representing water and flowing water. + */ + Tag FLUIDS_WATER = Bukkit.getTag(REGISTRY_FLUIDS, NamespacedKey.minecraft("water"), Fluid.class); /** * Returns whether or not this tag has an entry for the specified item.