-
Notifications
You must be signed in to change notification settings - Fork 0
Creating a fluid
This guide assumes you've already created and setup an Avoid project.
This guide uses meta-programming. Another way may either not be implemented or you may need to figure it out on your own.
§ Making a fluid with the Avoid Framework
-
Create a java class;
You can pick any location within your project source code directory. -
Paste the following code:
package com.example.avoidtmpl.fluid; import pl.olafcio.avoid.mods.annotation_processor.AutoFluid; import pl.olafcio.avoid.mods.annotation_processor.AutoID; import pl.olafcio.avoid.net.block.Blocks; import pl.olafcio.avoid.net.fluid.Fluid; import pl.olafcio.avoid.net.fluid.FluidState; import pl.olafcio.avoid.net.fluid.properties._layer; import pl.olafcio.avoid.net.fluid.properties.layer.ChunkLayer; import pl.olafcio.avoid.net.id.Identification; import pl.olafcio.avoid.net.item.Item; import pl.olafcio.avoid.net.world.block_data.BlockData; @AutoFluid @AutoID @_layer(ChunkLayer.SOLID) @_gravity @_swimmable @_unbreatheable public class OilFluid extends Fluid { @Override public Item getBucket() { return Item.of("lava_bucket"); // replace this with a new bucket item for your fluid! } @Override public Identification getBlockType() { return Identification.of("testmod:oil"); // replace this with [your mod ID]:[your fluid ID] } @Override public BlockData createBlock(FluidState state) { return Blocks.create(Identification.of("testmod:oil")); // replace this with [your mod ID]:[your fluid ID] } }
Of course you need to replace the class name and package.
-
Set the layer;
You can change the fluid's layer (which is kinda like a rendering type) by changing the@_layerline.
Here are all the layers you can pick from:Constant Explanation SOLID Makes the fluid opaque. CUTOUT Draws a stroke around the fluid. (TODO Is this true?) TRANSLUCENT Makes the fluid translucent/see-through. TRIPWIRE That's where I have no clue. (If you're using the SOLID layer, you don't have to specify the
@_layerdeclaration.) -
Customize it as you wish;
You can change the fluid's tick methods and more in the class contents itself [by overriding inherited Fluid methods].
Other than the @_layer property, you can also tinker with all of those:-
@_gravity: enables gravity for the fluid. -
@_swimmable: enables swimming for entities inside the fluid. -
@_unbreatheable: enables air mechanics for the fluid. -
: changes the model of the fluid.
@_model( flowing = @ID(namespace = "minecraft", path = "lava_flow"), still = @ID(namespace = "minecraft", path = "lava_still") )
-
-
Create a block.
Then, mark it as@_liquid(fluid = YourFluid.class).
You probably also want to mark it as@_noCollisionand@_replaceable(don't you?). -
Create a fog.
A fog is the blur around you, that appears when:- going into caves,
- going into a fluid (e.g. water), and
- when you have the blindness effect.
There may be more cases when a fog appears, of course.
You cannot assign the water's fog just with an annotation, because the fog itself decides about when to appear - it's not invoked by someone else.
©️ Copyright 2026 Olafcio (on behalf of the AvoidLib org)
📝 Licensed with CC BY-NC (Attribution-NonCommercial)