Custom Fluids
Supported by Forge on all versions, and Fabric on 1.18.2+
// Startup script
onEvent('fluid.registry', event => {
// These first examples are 1.16.5 and 1.18.2 syntax
// Basic "thick" (looks like lava) fluid with red tint
event.create('thick_fluid')
.thickTexture(0xFF0000)
.bucketColor(0xFF0000)
.displayName('Thick Fluid')
.luminosity(8)
// Basic "thin" (looks like water) fluid with cyan tint, has no bucket and is not placeable
event.create('thick_fluid')
.thinTexture(0xFF0000)
.bucketColor(0x00FFFF)
.displayName('Thin Fluid')
.noBucket() // both these methods are 1.18.2+ only
.noBlock()
// Fluid with custom textures
event.create('strawberry_cream')
.displayName('Strawberry Cream')
.stillTexture('kubejs:block/strawberry_still')
.flowingTexture('kubejs:block/strawberry_flow')
.bucketColor(0xFF33FF)
// For 1.18.1 the syntax is slightly different
event.create('thick_fluid', fluid => {
fluid.textureThick(0xFF0000) // the texture method names are different in 1.18.1 and below, textureXyz instead of xyzTexture
fluid.bucketColor(0xFF0000)
fluid.displayName('Thick Fluid')
})
})
In 1.18.1, 1.17 and 1.16 the texture method names are swapped, so textureStill and textureThin instead of stillTexture and thinTexture
Methods that you can use after the event.create('name')
You can use .bucketItem or .block to get a different builder.
If you one want to use one of these, then you can place it at the end of the other methods then use the its methods instead.
However if you want to use both, then you need to use the following code:
// notice this script has not been tested
onEvent('fluid.registry', event => {
let fluid = event.create('taco_suace')
.thickTexture(0xFF0000)
.bucketColor(0xFF0000)
fluid.bucketItem.group("food")
fluid.block.opaque(true) //no idea if this works or not
})
Some amount of the methods in these builders will not work or cause problems