|
| 1 | +# Creating fluids |
| 2 | + |
| 3 | +::: info Warning {id="warning"} |
| 4 | +This requires at least version 0.7.0 of GroovyScript. |
| 5 | +::: |
| 6 | +## The simplest way |
| 7 | + |
| 8 | +```groovy:no-line-numbers |
| 9 | +content.createFluid(String name).register() |
| 10 | +``` |
| 11 | + |
| 12 | +Simple right? |
| 13 | +Let's break it up: |
| 14 | + |
| 15 | +- `content` is a global variable. |
| 16 | +- `createFluid(String name)` creates a fluid builder object and returns it. The name is the registry name and must only |
| 17 | + consist of lower case letters and `_`. |
| 18 | +- `register()` registers the item. Without this the item will not appear in game. |
| 19 | + |
| 20 | +This will create a bucket item and a fluid block with a white water texture. |
| 21 | + |
| 22 | +## Setters |
| 23 | + |
| 24 | +- `setStill(ResourceLocation)` sets the still fluid texture |
| 25 | +- `setFlowing(ResourceLocation)` sets the flowing fluid texture |
| 26 | +- `setOverlay(ResourceLocation)` sets the overlay fluid texture (usually null) |
| 27 | +- `setTexture(ResourceLocation still, ResourceLocation flowing)` sets the still and flowing fluid texture |
| 28 | +- `setTexture(ResourceLocation still, ResourceLocation flowing, ResourceLocation overlay)` sets the still, flowing and overlay fluid texture |
| 29 | +- `setDefaultTexture()` sets the still and flowing texture to the default texture (white water) |
| 30 | +- `setMetalTexture()` sets the still and flowing texture to the tinkers molten metal texture |
| 31 | +- `setColor(int)` sets fluid color. The texture is usually white. The color is applied on top of the texture |
| 32 | +- `setSound(SoundEvent fillSound, SoundEvent emptySound)` sets the sounds for emptying and filling a bucket (default is from the fluids material) |
| 33 | +- `setLuminosity(int)` sets the luminosity. The light level of the fluid from 0 to 15 (default is 0). |
| 34 | +- `setDensity(int)` sets the density. Completely arbitrary value. Negative values imply that fluid is lighter than air. Default is 1000. |
| 35 | +- `setTemperature(int)` sets the temperature. Completely arbitrary value. Default is 300 (room temperature in Kelvin). |
| 36 | +- `setViscosity(int)` sets the viscosity. Completely arbitrary value Higher value makes the fluid flow slower. Default is 1000. |
| 37 | +- `setGaseous(boolean)` sets if the fluid is a gas. Generally this is associated with negative density fluids. Default is false. |
| 38 | +- `setRarity(EnumRarity)` sets the fluid rarity. This is only used for tooltip colors (afaik). Default is `EnumRarity.COMMON`. |
| 39 | +- `setWaterMaterial()` sets the fluid material to water. This makes the fluid blocks to behave like water. This is used by default. |
| 40 | +- `setLavaMaterial()` sets the fluid material to lava. This makes the fluid blocks to behave like lava. (No custom materials currently) |
| 41 | +- `noBlock()` disables the fluid block from generating. Buckets will not be able to place the fluid in the world. |
| 42 | + |
| 43 | +::: details Example {open id="example"} |
| 44 | +````groovy |
| 45 | +content.createFluid('molten_iron') |
| 46 | + .setMetalTexture() |
| 47 | + .setColor(0xFF0000) |
| 48 | + .setLuminosity(4) |
| 49 | + .setDensity(1700) |
| 50 | + .setTemperature(1300) |
| 51 | + .setViscosity(1500) |
| 52 | + .setLavaMaterial() |
| 53 | + .register() |
| 54 | +```` |
| 55 | +::: |
| 56 | + |
| 57 | +## Registering a fluid |
| 58 | + |
| 59 | +The example above creates a simple fluid for you, but you can also create fluids yourself. |
| 60 | +Use the following methods to register custom fluids. |
| 61 | + |
| 62 | +```groovy:no-line-numbers |
| 63 | +content.registerFluid(Fluis) |
| 64 | +``` |
| 65 | + |
| 66 | +::: info Warning {id="warning"} |
| 67 | +This is not recommended since using `createFluid(name).register()` does a lot of work for you. |
| 68 | +::: |
| 69 | + |
| 70 | +## Texture |
| 71 | + |
| 72 | +We recommend to use the default textures. But you can add other yourself. |
| 73 | +If a fluid has a block the block state json is automatically generated, |
| 74 | + |
| 75 | +## Translating the fluids name |
| 76 | + |
| 77 | +Add `fluid.[pack id].[fluid name]=Fluid Name` to your lang file |
| 78 | + |
| 79 | +Example for molten iron: |
| 80 | +```mclang:no-line-numbers |
| 81 | +fluid.placeholdername.molten_iron=Molten Iron |
| 82 | +``` |
0 commit comments