Class Fluids

java.lang.Object
fr.robie.machineengine.api.resource.Fluids

public final class Fluids extends Object
Fluids: one global category, machineengine:fluid, for every addon and definition (D29). MachineEngine registers water and lava; addons create their own fluids in the same category with create(Key), so a pipe or port accepting any() moves every registered fluid. Fluid keys are <namespace>:fluid/<name>.

Every fluid MachineEngine and addons make is a FluidType (D47): water and lava are vanilla fluids, others live in tanks and pipes, or are placeable in the world too (FluidType.builder(Key)).

The unit, scale and bucket size are set in config.yml (resources.fluid) and read when the fluids are built.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ConfigKey<Long>
     
    static final net.kyori.adventure.key.Key
     
    static final ConfigKey<Integer>
     
    static final net.kyori.adventure.key.Key
     
    static final ConfigKey<Integer>
     
    static final ConfigKey<String>
     
    static final ConfigKey<Integer>
    Vanilla's default water color; the menus' tint of water.
    static final net.kyori.adventure.key.Key
     
    static final net.kyori.adventure.key.Key
     
    static final net.kyori.adventure.key.Key
    The world fluids, as WorldFluid and the MachineWorld fluid calls name them.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull ResourcePredicate
    any()
    Matches every fluid.
    static @Nullable FluidType
    asFluid(@NotNull ResourceType type)
    type as a FluidType, or null if it is not one.
    static long
    The amount of fluid in one bucket.
    static @NotNull ResourceCategory
    The category machineengine:fluid, with the configured unit and scale.
    static @NotNull FluidType
    create(@NotNull net.kyori.adventure.key.Key key)
    A new fluid in the global category that lives only in tanks, pipes and items, e.g.
    static @NotNull FluidType
    create(@NotNull net.kyori.adventure.key.Key key, int color)
    A new fluid with a menu color (0xRRGGBB), as create(Key).
    static @Nullable ResourceType
    fromWorld(@NotNull net.kyori.adventure.key.Key worldFluid)
    The fluid of a world fluid: water or lava for minecraft:water / minecraft:lava, the placeable fluid registered under that key, null for others (or while MachineEngine is not running).
    static boolean
    isFluid(@NotNull ResourceType type)
    Whether type is a fluid: a FluidType, or a plain type in the global fluid category (older addons).
    static boolean
    isVanillaKey(@NotNull net.kyori.adventure.key.Key key)
    Whether key is MachineEngine's water or lava.
    static @NotNull FluidType
    machineengine:fluid/lava.
    static @NotNull FluidType
    machineengine:fluid/water.
    static @Nullable net.kyori.adventure.key.Key
    worldFluid(@NotNull ResourceType type)
    The world fluid of a fluid, as WorldFluid and the MachineWorld fluid calls name them: minecraft:water or minecraft:lava for those, the fluid's own key for a placeable fluid (D46), null for fluids with no block.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CATEGORY_KEY

      public static final net.kyori.adventure.key.Key CATEGORY_KEY
    • WATER_KEY

      public static final net.kyori.adventure.key.Key WATER_KEY
    • LAVA_KEY

      public static final net.kyori.adventure.key.Key LAVA_KEY
    • WORLD_WATER

      public static final net.kyori.adventure.key.Key WORLD_WATER
      The world fluids, as WorldFluid and the MachineWorld fluid calls name them.
    • WORLD_LAVA

      public static final net.kyori.adventure.key.Key WORLD_LAVA
    • UNIT

      public static final ConfigKey<String> UNIT
    • SCALE

      public static final ConfigKey<Integer> SCALE
    • BUCKET

      public static final ConfigKey<Long> BUCKET
    • WATER_COLOR

      public static final ConfigKey<Integer> WATER_COLOR
      Vanilla's default water color; the menus' tint of water.
    • LAVA_COLOR

      public static final ConfigKey<Integer> LAVA_COLOR
  • Method Details

    • category

      @NotNull public static @NotNull ResourceCategory category()
      The category machineengine:fluid, with the configured unit and scale.
    • water

      @NotNull public static @NotNull FluidType water()
      machineengine:fluid/water.
    • lava

      @NotNull public static @NotNull FluidType lava()
      machineengine:fluid/lava.
    • bucket

      public static long bucket()
      The amount of fluid in one bucket.
    • any

      @NotNull public static @NotNull ResourcePredicate any()
      Matches every fluid.
    • create

      @NotNull public static @NotNull FluidType create(@NotNull @NotNull net.kyori.adventure.key.Key key)
      A new fluid in the global category that lives only in tanks, pipes and items, e.g. Fluids.create(Key.key("mymod", "fluid/oil")). Register it with context.resourceTypes().register(...) like any resource type. For a fluid that can be placed in the world, use FluidType.builder(Key).
    • create

      @NotNull public static @NotNull FluidType create(@NotNull @NotNull net.kyori.adventure.key.Key key, int color)
      A new fluid with a menu color (0xRRGGBB), as create(Key).
    • isFluid

      public static boolean isFluid(@NotNull @NotNull ResourceType type)
      Whether type is a fluid: a FluidType, or a plain type in the global fluid category (older addons).
    • asFluid

      @Nullable public static @Nullable FluidType asFluid(@NotNull @NotNull ResourceType type)
      type as a FluidType, or null if it is not one.
    • isVanillaKey

      public static boolean isVanillaKey(@NotNull @NotNull net.kyori.adventure.key.Key key)
      Whether key is MachineEngine's water or lava.
    • worldFluid

      @Nullable public static @Nullable net.kyori.adventure.key.Key worldFluid(@NotNull @NotNull ResourceType type)
      The world fluid of a fluid, as WorldFluid and the MachineWorld fluid calls name them: minecraft:water or minecraft:lava for those, the fluid's own key for a placeable fluid (D46), null for fluids with no block.
    • fromWorld

      @Nullable public static @Nullable ResourceType fromWorld(@NotNull @NotNull net.kyori.adventure.key.Key worldFluid)
      The fluid of a world fluid: water or lava for minecraft:water / minecraft:lava, the placeable fluid registered under that key, null for others (or while MachineEngine is not running).