|This Article is up to date with Custom Stuff 2|
A liquid is set up as a block meaning that the code for it inhabits a .block file. There are several distinct differences between the setup for liquids and normal blocks, however, as detailed below.
Example Fluid Block (CS2 0.10.6)
config.addBlockIdProperty("yourFluidID",1226 ); mod.addBlock("yourFluid.js", "fluid");
yourFluid.js (blocks folder)
id = config.getBlockId("yourFluidID"); name = "yourFluid"; displayName = "yourFluid"; resistance = 500; semiTransparent = true; //otherwise liquid looks solid material = "water"; //must be lava or water infiniteSource = true; //infinite like water if set to true. density = 500; //how dense the material is. Used for mods. flowLength = 4; //between 1-16, and tells how far your liquid goes. viscosity = 6000 //how fast your liquid expands. Bigger numbers make it slow. textureFileFlowing = "yourFluidFlow.png"; textureFileStill = "yourFluidStill.png";
Example Fluid Block (CS2 0.10.5 and below)
config.addBlockIdProperty("mysteryFluidMovingID", 173); config.addBlockIdProperty("mysteryFluidStillID", 174); mod.addBlock("mysteryFluid.js", "fluid");
mysteryFluid.js - goes in blocks folder
id = config.getBlockId("mysteryFluidMovingID"); id2 = config.getBlockId("mysteryFluidStillID"); name = "mysteryFluid"; displayName = "Mysterious Fluid"; resistance = 500; semiTransparent = true; //otherwise liquid looks solid //material must be water or lava material = "water"; //determines if you can make an infinite supply like with water infiniteSource = false; //uses color instead of textureFile and textureIndex color = "F72E64";
Custom liquids can be picked up using a vanilla bucket, just like any other liquid as long as a CS2 bucket is added. If you have not already, refer to the bucket page for more information.
Example Liquid Block (CS1)
name="Glowing Goo"; id=125; id2=126; texturefile="Just4Fun.png"; type="liquid"; material="water"; flowspeed=8; light=14; infinitesource="false"; addtocreative="false";
Liquid Block Attributes
Below is a table of attributes available to liquid-type blocks, including information on notable attributes.
This is a second block ID used for the flowing liquid. It must be set to a different ID number than the normal block, and draws from the same pool of available block IDs as every other block does
This must be set to 'liquid' in order for the block to be of the liquid type.
There are two types of material reserved entirely for liquids. These are "water" and "lava. In many ways, a custom liquid will function exactly like its namesake. See Water and Lava for more on how they work
You can only define the file that the liquid draws from, but not the exact tiles. See "Liquid Texturing" below.
Texturing liquids works the same in Custom Stuff as it did in the Alpha version of Minecraft. There are ten spaces on a texture sheet (five for water and five for lava) that are reserved specifically for this purpose. For water, these are indexes 205 - 207 and 222 - 223. For lava these are 237 - 239 and 254 - 255. They are the same areas that the water and lava textures appear in in terrain.png, and they CANNOT be changed.
This means that for each liquid of a particular type, you'll need a dedicated texture sheet. A water-material liquid and a lava-material liquid can share a sheet, however, meaning that if you're intent on introducing a lot of liquids you can double up. Likewise, if you're only introducing a single new liquid you'll need to arrange your texture sheet around the five slots necessary for the liquid's textures.
Unfortunately, it is not possible to have liquids animate by default. To have an animated liquid texture, you will require the use of a texture pack and MCPatcher or Optifine. Even setting up the animation and putting it into the proper location will not help as since MCPatcher and Optifine will skip animations if the texture pack is set to default.
Unlike most other blocks, however, liquids DO support partial transparency, meaning you can control how opaque (or see-though) the liquid is by altering the texture file. All liquids presently use their material namesake's opacity value, so you aren't able to set it manually.
Although Fluids are more amiable than in previous versions, there are still a lot of things that cannot be changed or controlled outside of the two 'material' options available. Here are a short list of things that cannot yet be changed or added. Feel free to add more as you come up with them.
- Adding animation to flowing liquids without a texture pack.
- Assigning textureindexes to liquids.
- Defining how far a liquid flows away from its source block.
- Assigning how fast damage is dealt by submersion in a liquid.
- Making a damaging liquid that does not set the victim on fire.
- Defining whether or not a liquid depletes air.
- Define how liquids interact with one another.
- Presently custom liquids interact the same way their material namesakes interact.
- Control the particles that are associated with liquids.
- Blue bubbles will always 'splash' when something jumps into a custom water.
- Custom Lava will emit smoke and embers
- The patricles visible when submerged in a custom liquid will always be the same as water.
- When a liquid cascades over a large surface, it may take a long time for it to clear once the source block is removed. This same behavior is exhibited by lava in the vanilla game. Note that for CS Liquids, however, a liquid with the water material will still exhibit this behavior.
- A source block of water will sustain flowing CS liquids with the water material, and vice-verse.
- The same holds true for lava and lava-material liquids.
- The texture indexes for liquids are fixed and cannot be changed.
- The indexes are the same ones used by water and lava (depending on the material chosen) in terrain.png
- The visual distortion and coloration seen when submerged is the same as that of the respective vanilla liquid.