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

The following can also be used but have no effect unless a mod adds a purpose:

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



Revision #10
Created 19 May 2021 17:13:31 by Lat
Updated 7 August 2023 00:12:47 by Q6