Fluid
Link to fluid
This allows you to add fluids to the game!
Create the Fluid Representation
Link to create-the-fluid-representation
Before you can add the fluid, you need to create a Fluid Representation which will allow you to set the properties of the fluid you want to add.
This is where the VanillaFactory comes in:
ZenScript Copymods.contenttweaker.VanillaFactory.createFluid(String unlocalizedName, int color);
mods.contenttweaker.VanillaFactory.createFluid(String unlocalizedName, CTColor color);
Import the representation Package
Link to import-the-representation-package
It might be required for you to import the package if you encounter any issues, so better be safe than sorry and add the import.
import mods.contenttweaker.Fluid;
ZenProperties
Link to zenproperties
To get/set the properties you can either use the respecting ZenGetters/Setters or the ZenMethods:
ZenScript Copy//property name: density
//ZenGetter
print(fluid.density);
//ZenSetter
fluid.density = 500;
//ZenMethods
fluid.getDensity();
fluid.setDensity(1000);
Property Name | Type | Required | Default Value | Description/Notes |
---|---|---|---|---|
Property Name unlocalizedName | Type string | Required Yes | Default Value | Description/Notes Name, should be all lowercase |
Property Name density | Type int | Required No | Default Value 1000 | Description/Notes How fast you can walk in the fluid |
Property Name gaseous | Type boolean | Required No | Default Value false | Description/Notes Is the fluid gaseous (flows upwards instead of downwards)? |
Property Name luminosity | Type int | Required No | Default Value 0 | Description/Notes The light-level emitted by the fluid |
Property Name temperature | Type int | Required No | Default Value 300 | Description/Notes The Fluid's temperature |
Property Name color | Type int | Required Yes | Default Value | Description/Notes The Fluid's color-code |
Property Name colorize | Type boolean | Required No | Default Value true | Description/Notes Is the fluid's color-code applied? |
Property Name rarity | Type string | Required No | Default Value COMMON | Description/Notes How rare a fluid is, determines ToolTip color ("COMMON", "UNCOMMON", "RARE", "EPIC") |
Property Name viscosity | Type int | Required No | Default Value 1000 | Description/Notes How quickly the fluid spreads |
Property Name fillSound | Type ISoundEventDefinition | Required No | Default Value ITEM_BUCKET_FILL | Description/Notes The sound played when the fluid is picked up with a Bucket |
Property Name emptySound | Type ISoundEventDefinition | Required No | Default Value ITEM_BUCKET_EMPTY | Description/Notes The sound played when the fluid is placed |
Property Name vaporize | Type boolean | Required No | Default Value false | Description/Notes Does vaporize when placed in the Nether? |
Property Name stillLocation | Type string | Required No | Default Value contenttweaker:fluids/fluid | Description/Notes The Location where to find the texture for the still fluid |
Property Name flowingLocation | Type string | Required No | Default Value contenttweaker:fluids/fluid_flow | Description/Notes The Location where to find the texture for the flowing fluid |
Property Name material | Type IMaterialDefinition | Required No | Default Value WATER | Description/Notes The Material the fluid is made of |
Registering the fluid
Link to registering-the-fluid
You need to call this method to register the fluid in the game!
Otherwise nothing will happen!
After you have called this function, you cannot un-register the fluid or change any of it's properties!
ZenScript Copyfluid.register();
Example Script
Link to example-script
ZenScript Copy#loader contenttweaker
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.Fluid;
import mods.contenttweaker.Color;
var zsFluid = VanillaFactory.createFluid("zs_fluid", Color.fromHex("FF69B4"));
zsFluid.fillSound = <soundevent:block.anvil.place>;
zsFluid.register();
Localizing the fluid
Link to localizing-the-fluid
You will need to add fluid.fluidName = Localized Name
to the responding language files.
Alternatively, you could use CraftTweaker's localization feature, though it's recommended using the language files!