Skip to main content

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')

  • displayName(name)
  • color(color)
  • bucketColor(color)
  • builtinTextures()
    • same ass thinTexture(0xFFFFFF)
  • stillTexture(path)
    • path is the path to txture is for example maybe "minecraft:block/sand"
    • this texture is recomended to be 16x16, or if animated with a mcmeta file then 16x48 for 3 frames or 16x80 for 5 or 16x240 for 15
    • Frame counts of 3, 5, 15, 6, 10, or 30 will make your life easier, because the flowing animation need to be a multiple of 15 to look good
  • flowingTexture(path)
    • path is the path to texture is for example maybe "minecraft:block/sand"
    • this texture is recommended to be 32x480 and animated with a mcmeta file
    • each frame is recommended to be 32x32 (recommended to be the same 16x16 texture tiled)
    • then each of these frames are shifted one pixel vertically from the previous, so it looks like its moving
    • If you are going to be making your own flowing fluid texture it is highly recommended to not make these by hand (It is hours of suffering), and instead write a some program, or setup something with blender nodes to make it.
  • luminosity(value)
    • default 0
  • density(value)
    • default 1000
  • temperature(value)
    • default 300
  • viscosity(value)
    • default 1000
  • noBucket()
  • noBlock()
  • gaseous()
    • It is now a gas
  • rarity(value)
    • Can be:
      • "common"
      • "uncommon"
      • "rare"
      • "epic"

There is a good chance the following does not work at all

You can use .bucketItem to get the bucket item builder.

If you one want to use it then you can place it at the end of the other methods then use the its methods instead.

// notice this script has not been tested
onEvent('fluid.registry', event => {
  event.create('taco_suace')
                .thickTexture(0xFF0000)
                .bucketColor(0xFF0000)
                .bucketItem
                .group("food")
})

Some amount of the methods in these builders will not work or cause problems

    • .bucketItem