Skip to Content
1robie

World fluids

Fluids you can pour into the world: buckets, flow, textures, physics, mixing, effects, and the settings behind them.

A fluid can leave its tanks and pipes: poured from a bucket, it flows, swims and looks like its own liquid, with its own textures, fog, physics and effects. Players need no mod: the look comes from MachineEngine's resource pack.

Since 0.2.0

World fluids came in MachineEngine 0.2.0. They work on every supported version, 1.20.6 to 26.3, Paper and Folia.

Making a fluid placeable

Any fluid resource type can be placeable. Add a fluid: section to its definition (see Resources):

resource-types:
  mypack:fluid/oil:
    category: machineengine:fluid
    color: '#2A2238'
    fluid:
      world: placeable
      look:
        texture:
          {source: recolor, pattern: lava, from: '#0A080E', to: '#4E3E60'}
        opacity: 0.96
        fog: '#0B0806'
      physics:
        viscosity:
          {speed: 0.5, gravity: 1.6, jump: 0.5, damping: 0.35, entity-drag: 0.3}
        spread: {ticks: 15, range: 5}
        infinite-source: false
      mixing:
        - {with: water, result: stop}
        - {with: lava, result: block, block: minecraft:obsidian}
      effects:
        - {type: potion, effect: minecraft:slowness}

Only world: placeable is needed: everything else defaults to water. A fluid without textures is the water texture in its menu color. Unknown fields are refused at startup with their path, so typos show in /machineengine report.

FieldDefaultMeaning
worldnonenone: tanks and pipes only. placeable: it can be in the world.
bucketautoauto: a water bucket named after the fluid. none: no bucket. Or a CraftEngine item key, such as mypack:oil_bucket.
lookwaterTextures, tint, opacity, glow, fog (below).
physicswaterHow it moves things and flows (below).
mixingstopWhat happens where it flows into another fluid (below).
effectsnoneWhat it does to whoever is inside (below).

Look

FieldDefaultMeaning
texturewater'sStill and flowing texture at once.
stillwater'sThe still texture.
flowwater'sThe flowing texture.
tintmenu color, or white with a textureColor multiplied over the texture, '#RRGGBB'.
opacity0.70 (invisible) to 1 (opaque).
glow00 to 1: how much it ignores darkness. 1 is fully lit, like a light source.
fogthe tintUnderwater fog color, '#RRGGBB'.
frame-time2Ticks per animation frame.

A texture is a resource pack key, such as mypack:block/oil_still, or a map with a source:

SourceFieldsDraws
filetextureA texture of the CraftEngine resource packs (same as a key).
vanillatexture (default block/water_still)A vanilla texture, such as block/lava_still.
recolorpattern, from, toA vanilla fluid pattern (water, lava) recolored from dark to light.
crystalscolor, sparkleDrawn, twinkling crystals.
bubblescolor, bubbleDrawn, rising bubbles.

Fluids that look the same share one look on the client, so 22 placeable fluids with 22 different looks fit, and more if some look alike.

Physics

FieldDefaultMeaning
viscosity.speed1Walking and swimming speed multiplier.
viscosity.gravity1Gravity multiplier inside.
viscosity.jump1Jump strength multiplier.
viscosity.swim00 to 1: swims faster than water (1.21+).
viscosity.damping00 to 0.9: speed players lose inside, for thick fluids.
viscosity.entity-drag00 to 0.9: speed mobs, items and boats lose inside.
spread.ticks5Ticks per flowing step, 5 (water's) or slower.
spread.range7Blocks it flows from a source on flat ground, 1 to 7.
infinite-sourcetrueTwo of its sources make a new one, like water.
mixed-sourcenoneWhat a source formed between it and another fluid becomes: none (stays flowing) or water.

Gravity and jump need 1.20.5 or later. Players' speed, gravity and jump are attributes their client predicts, so they feel smooth; damping is applied by the server and can stutter a little.

Mixing

Rules for where it flows into another fluid. The first rule that matches decides; without one, both stop where they meet.

withMatches
water, lavaThat vanilla fluid
anyAny other fluid
'#mypack:hot_fluids'A resource tag
mypack:fluid/acidOne fluid
resultFieldsDoes
stopBoth stop.
flowIt replaces the fluid there.
blockblockThe block becomes this block, like lava meeting water.
fluidfluidThe block becomes a source of this placeable fluid.

Effects

Effects run every 10 ticks on whoever is inside.

typeFieldsDoes
potioneffect, amplifier: 0Keeps a potion effect on while inside.
damageamount: 1, every: 20Damage every every ticks.
fireticks: 60Sets on fire.
freezeticks: 140Freezes, like powder snow.

Mobs and items feel effects and drag too, unless entity-effects is off.

Changing a fluid without a restart: fluids.yml

plugins/MachineEngine/fluids.yml overrides any placeable fluid, including those of addons such as Mekanized. On first start it lists every placeable fluid with its current values, ready to copy. Write only the fields to change:

fluids:
  mekanized:fluid/brine:
    look: {tint: '#E8DDB5', opacity: 0.8}
    physics:
      viscosity: {speed: 0.8}

/machineengine reload fluids applies it:

WhatApplies
physics, mixing, effectsAt once
look (textures, tint, opacity, glow…)After the pack is rebuilt
look.fogAfter players rejoin

world and bucket can't be changed there: set them in the definition and restart.

The resource pack

MachineEngine writes the fluids' textures and a patched water shader into CraftEngine/resources/machineengine/resourcepack, so CraftEngine sends them with its pack. It builds them from the official Minecraft client jar, which it downloads from Mojang once and keeps in plugins/MachineEngine/cache.

After changing looks, rebuild and resend the pack:

/machineengine reload fluids
/ce reload pack

Players' renderers

RendererSees
VanillaEvery fluid with its own look.
Sodium 0.9 and later (Minecraft 26.2+)The same: MachineEngine ships a patched Sodium shader too.
Older Sodium, OptiFine, shader packsWater, with fluids in their code color (with textures: tint).

textures: auto (the default) picks the texture grid on 26.2 and later, where Sodium reads the pack's shader, and tint only before, so nobody sees the grid.

Settings

Under world-fluids: in config.yml. Restart marks settings that need one; pack marks those that apply after the pack is rebuilt.

SettingDefaultEffect
enabledtruePlaceable fluids in the world. Off: fluids only live in tanks and pipes. Restart.
uniform-watertrueEvery biome's water gets the neutral color for players (swamps and oceans lose their tint). Needed for more than 6 fluid looks. Restart, then players rejoin.
neutral-color'#3F76E4'That neutral water color. Restart, then players rejoin.
neutral-rings6Without uniform-water only: 4-block areas around a fluid that get the neutral color. Restart.
shadertrueDraw fluids with their own look. Off: fluids are water tinted with a code color. Pack.
sodiumtrueAlso for players using Sodium 0.9+. Pack.
sodium-jardownloadWhere Sodium's shader comes from: the newest Sodium from Modrinth, or the path of a Sodium jar.
texturesautogrid: fluids can have their own textures. tint: each fluid is the water texture in its color. auto: grid from 26.2. Pack.
bucket-texturestrueA texture for each fluid's bucket item: the vanilla water bucket in the fluid's color. Pack.
water-modelstrueWith the grid, packs' models that draw vanilla water (menu fluid bars) use an untouched copy. Pack.
edgesoftWhere a fluid meets water: soft (fades) or sharp (a line). Pack.
conflictstopstop: a fluid and plain water never share a 4-block color area. allow: they may, and the fluid fades into the water around it.
fluid-gap24-block areas kept between two different fluids (2 is about 8 blocks).
padding14-block areas around a fluid, where no water is, that get its color: cleaner shores.
dispersion2With conflict: allow: areas where a fluid fades into plain water.
client-jardownloadWhere vanilla's textures and shaders come from: the official client jar, or the path of one.
texture-grid8Most fluid textures per side of the grid: 8 holds 63 textures, 16 holds 255.
update-delay10Ticks a changed chunk waits before its colors are sent (changes in between go together).
entity-effectstrueEffects and drag on mobs and items too (players always). Restart.
entity-ticks4Ticks between two scans for mobs and items in fluids. Restart.
debug-colorsfalseShows how the shader reads each water face (below). Pack.

Commands

All need machineengine.admin. Except info, they act on what you look at and are for players only.

CommandDoes
/machineengine fluid infoFluids, looks, updates sent; and for the block you look at, its fluid and color area.
/machineengine fluid show <fluid> [radius]Particles at your feet: green where the fluid may go, red where it may not. show off stops it.
/machineengine fluid fill <fluid|water> [max]The water you look at, and the water joined to it (up to max, 4000), becomes the fluid (or plain water).
/machineengine fluid bucket <fluid>Gives you the fluid's bucket.
/machineengine fluid clearTurns every placeable fluid of your world back into plain water.
/machineengine reload fluidsReloads fluids.yml and rebuilds the pack.

How it works, and its limits

A placed fluid is vanilla water underneath: it flows, swims and drowns like water, and MachineEngine remembers which water blocks hold which fluid (saved in the chunk). Players see the difference because MachineEngine colors that water with a code, and the resource pack's shader turns each code into its fluid's look.

The client colors water by 4-block areas (biome cells) and blends the areas around each block. That sets the rules:

  • Two different fluids keep a gap (fluid-gap). Blended together, two codes are no fluid at all, so the blocks between them would show plain water. Placing a fluid too close to another is refused, and fluid show tells you where it may go.
  • A fluid and plain water don't share an area under conflict: stop: a fluid stops where plain water uses the area, and the other way round.
  • Biome Blend (Video Settings) spreads colors a few blocks. With Sodium, each corner also blends the blocks around it, so the tip of a fluid pointing at another pool may fade a little. fluid-gap: 3 removes that. Very wide Biome Blend (15×15) needs a wider gap.

Troubleshooting

A fluid shows as water

Set debug-colors: true, then /machineengine reload config, /machineengine reload fluids and /ce reload pack. Water faces show what the shader read:

ColorMeaning
GreenThe fluid, drawn fully.
YellowThe fluid, fading into water.
OrangeWater with no fluid found: two fluids' colors mixed (too close, see fluid-gap).
MagentaPlain water.
Looks like waterThe shader did not run: an old Sodium, OptiFine or a shader pack.

/machineengine fluid info, looking at the block, tells you what the server sent for it and the 8 blocks around. Set debug-colors back to false and rebuild the pack when you are done.

Players see a grid on all water

Their renderer does not read the pack's shader (Sodium before 0.9, OptiFine, a shader pack). Use textures: tint, or keep auto on versions before 26.2.

The pack is not built

The first build downloads the client jar from Mojang (and Sodium from Modrinth). Without internet access, set client-jar (and sodium-jar) to the path of a jar. The console tells you what was written.

For developers

The same fluids can be made in code: FluidType.builder(key).placeable()…build() from fr.robie.machineengine.api.resource.fluid. WorldFluids (fr.robie.machineengine.api.paper) reads, places and takes fluids in the world, and WorldFluidPlaceEvent, WorldFluidRemoveEvent and EntityFluidEvent (enter, leave) tell you when that happens. Your own effect, mixing result and texture types register like other MachineEngine types.

Last updated on

On this page