Class CauldronFluidContent
java.lang.Object
net.fabricmc.fabric.api.transfer.v1.fluid.CauldronFluidContent
Entrypoint to expose cauldrons to the Fluid Transfer API.
Empty, water and lava cauldrons are registered by default, and additional cauldrons must be registered with
registerCauldron(net.minecraft.block.Block, net.minecraft.fluid.Fluid, long, net.minecraft.state.property.IntProperty)
.
Contents can be queried with getForBlock(net.minecraft.block.Block)
and getForFluid(net.minecraft.fluid.Fluid)
.
The CauldronFluidContent
itself defines:
- The block of the cauldron.
- The fluid that can be accepted by the cauldron. NBT is discarded when entering the cauldron.
- Which fluid amounts can be stored in the cauldron, and how they map to the level property of the cauldron.
If
levelProperty
isnull
, thenmaxLevel = 1
, and there is only one level. Otherwise, the levels are all the integer values between1
andmaxLevel
(included). amountPerLevel
defines how much fluid (in droplets) there is in one level of the cauldron.
Experimental feature, we reserve the right to remove or change it without further notice. The transfer API is a complex addition, and we want to be able to correct possible design mistakes.
-
Field Summary
Modifier and TypeFieldDescriptionfinal long
Amount in droplets for each level oflevelProperty
.final net.minecraft.block.Block
Block of the cauldron.final net.minecraft.fluid.Fluid
Fluid stored inside the cauldron.final @Nullable net.minecraft.state.property.IntProperty
Property storing the level of the cauldron.final int
Maximum level forlevelProperty
. -
Method Summary
Modifier and TypeMethodDescriptionint
currentLevel
(net.minecraft.block.BlockState state) Return the current level of the cauldron given its block state, or 0 if it's an empty cauldron.static @Nullable CauldronFluidContent
getForBlock
(net.minecraft.block.Block block) Get the cauldron fluid content for a cauldron block, ornull
if none was registered (yet).static @Nullable CauldronFluidContent
getForFluid
(net.minecraft.fluid.Fluid fluid) Get the cauldron fluid content for a fluid, ornull
if no cauldron was registered for that fluid (yet).static CauldronFluidContent
registerCauldron
(net.minecraft.block.Block block, net.minecraft.fluid.Fluid fluid, long amountPerLevel, @Nullable net.minecraft.state.property.IntProperty levelProperty) Attempt to register a new cauldron if not already registered, allowing it to be filled and emptied through the Fluid Transfer API.
-
Field Details
-
block
public final net.minecraft.block.Block blockBlock of the cauldron. -
fluid
public final net.minecraft.fluid.Fluid fluidFluid stored inside the cauldron. -
amountPerLevel
public final long amountPerLevelAmount in droplets for each level oflevelProperty
. -
maxLevel
public final int maxLevelMaximum level forlevelProperty
.1
iflevelProperty
is null, otherwise a number>= 1
. The minimum level is always 1. -
levelProperty
@Nullable public final @Nullable net.minecraft.state.property.IntProperty levelPropertyProperty storing the level of the cauldron. If it's null, only one level is possible.
-
-
Method Details
-
getForBlock
Get the cauldron fluid content for a cauldron block, ornull
if none was registered (yet). -
getForFluid
Get the cauldron fluid content for a fluid, ornull
if no cauldron was registered for that fluid (yet). -
registerCauldron
public static CauldronFluidContent registerCauldron(net.minecraft.block.Block block, net.minecraft.fluid.Fluid fluid, long amountPerLevel, @Nullable @Nullable net.minecraft.state.property.IntProperty levelProperty) Attempt to register a new cauldron if not already registered, allowing it to be filled and emptied through the Fluid Transfer API. In both cases, return the content of the cauldron, either the existing one, or the newly registered one.- Parameters:
block
- The block of the cauldron.fluid
- The fluid stored in this cauldron.amountPerLevel
- How much fluid is contained in one level of the cauldron, in droplets.levelProperty
- The property used by the cauldron to store its levels.null
if the cauldron only has one level.
-
currentLevel
public int currentLevel(net.minecraft.block.BlockState state) Return the current level of the cauldron given its block state, or 0 if it's an empty cauldron.
-