Class Fluids
java.lang.Object
fr.robie.machineengine.api.resource.Fluids
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
FieldsModifier and TypeFieldDescriptionstatic final net.kyori.adventure.key.Keystatic final net.kyori.adventure.key.KeyVanilla's default water color; the menus' tint of water.static final net.kyori.adventure.key.Keystatic final net.kyori.adventure.key.Keystatic final net.kyori.adventure.key.KeyThe world fluids, asWorldFluidand theMachineWorldfluid calls name them. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ResourcePredicateany()Matches every fluid.static @Nullable FluidTypeasFluid(@NotNull ResourceType type) static longbucket()The amount of fluid in one bucket.static @NotNull ResourceCategorycategory()The categorymachineengine:fluid, with the configured unit and scale.static @NotNull FluidTypecreate(@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 FluidTypecreate(@NotNull net.kyori.adventure.key.Key key, int color) A new fluid with a menu color (0xRRGGBB), ascreate(Key).static @Nullable ResourceTypefromWorld(@NotNull net.kyori.adventure.key.Key worldFluid) The fluid of a world fluid: water or lava forminecraft:water/minecraft:lava, the placeable fluid registered under that key,nullfor others (or while MachineEngine is not running).static booleanisFluid(@NotNull ResourceType type) Whethertypeis a fluid: aFluidType, or a plain type in the global fluid category (older addons).static booleanisVanillaKey(@NotNull net.kyori.adventure.key.Key key) Whetherkeyis MachineEngine's water or lava.static @NotNull FluidTypelava()machineengine:fluid/lava.static @NotNull FluidTypewater()machineengine:fluid/water.static @Nullable net.kyori.adventure.key.KeyworldFluid(@NotNull ResourceType type) The world fluid of a fluid, asWorldFluidand theMachineWorldfluid calls name them:minecraft:waterorminecraft:lavafor those, the fluid's own key for a placeable fluid (D46),nullfor fluids with no block.
-
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_WATERThe world fluids, asWorldFluidand theMachineWorldfluid calls name them. -
WORLD_LAVA
public static final net.kyori.adventure.key.Key WORLD_LAVA -
UNIT
-
SCALE
-
BUCKET
-
WATER_COLOR
-
LAVA_COLOR
-
-
Method Details
-
category
The categorymachineengine:fluid, with the configured unit and scale. -
water
machineengine:fluid/water. -
lava
machineengine:fluid/lava. -
bucket
public static long bucket()The amount of fluid in one bucket. -
any
Matches every fluid. -
create
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 withcontext.resourceTypes().register(...)like any resource type. For a fluid that can be placed in the world, useFluidType.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), ascreate(Key). -
isFluid
Whethertypeis a fluid: aFluidType, or a plain type in the global fluid category (older addons). -
asFluid
-
isVanillaKey
public static boolean isVanillaKey(@NotNull @NotNull net.kyori.adventure.key.Key key) Whetherkeyis 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, asWorldFluidand theMachineWorldfluid calls name them:minecraft:waterorminecraft:lavafor those, the fluid's own key for a placeable fluid (D46),nullfor 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 forminecraft:water/minecraft:lava, the placeable fluid registered under that key,nullfor others (or while MachineEngine is not running).
-