Package net.neoforged.neoforge.fluids
Class CauldronFluidContent
java.lang.Object
net.neoforged.neoforge.fluids.CauldronFluidContent
Fluid content information for cauldrons.
Empty, water and lava cauldrons are registered by default,
and additional cauldrons must be registered with RegisterCauldronFluidContentEvent.
Contents can be queried with getForBlock(net.minecraft.world.level.block.Block) and getForFluid(net.minecraft.world.level.material.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
levelPropertyisnull, thenmaxLevel = 1, and there is only one level. Otherwise, the levels are all the integer values between1andmaxLevel(included). totalAmountdefines how much fluid (in millibuckets) there is in one level of the cauldron.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BlockBlock of the cauldron.private static final Map<Block, CauldronFluidContent> final FluidFluid stored inside the cauldron.private static final Map<Fluid, CauldronFluidContent> final @Nullable IntegerPropertyProperty storing the level of the cauldron.final intMaximum level forlevelProperty.final intAmount of#fluidin millibuckets in the entire full cauldron. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCauldronFluidContent(Block block, Fluid fluid, int totalAmount, int maxLevel, @Nullable IntegerProperty levelProperty) -
Method Summary
Modifier and TypeMethodDescriptionintcurrentLevel(BlockState state) Return the current level of the cauldron given its block state, or 0 if it's an empty cauldron.static @Nullable CauldronFluidContentgetForBlock(Block block) Get the cauldron fluid content for a cauldron block, ornullif none was registered (yet).static @Nullable CauldronFluidContentgetForFluid(Fluid fluid) Get the cauldron fluid content for a fluid, ornullif no cauldron was registered for that fluid (yet).static voidinit()(package private) static voidregister(Block block, Fluid fluid, int totalAmount, @Nullable IntegerProperty levelProperty) Do not try to call, use theRegisterCauldronFluidContentEventevent instead.static void
-
Field Details
-
block
Block of the cauldron. -
fluid
Fluid stored inside the cauldron. -
totalAmount
public final int totalAmountAmount of#fluidin millibuckets in the entire full cauldron. -
maxLevel
public final int maxLevelMaximum level forlevelProperty.1iflevelPropertyis null, otherwise a number>= 1. The minimum level is always 1. -
levelProperty
Property storing the level of the cauldron. If it'snull, only one level is possible. -
BLOCK_TO_CAULDRON
-
FLUID_TO_CAULDRON
-
-
Constructor Details
-
CauldronFluidContent
private CauldronFluidContent(Block block, Fluid fluid, int totalAmount, int maxLevel, @Nullable @Nullable IntegerProperty levelProperty)
-
-
Method Details
-
currentLevel
Return the current level of the cauldron given its block state, or 0 if it's an empty cauldron. -
getForBlock
Get the cauldron fluid content for a cauldron block, ornullif none was registered (yet). -
getForFluid
Get the cauldron fluid content for a fluid, ornullif no cauldron was registered for that fluid (yet). -
init
@Internal public static void init() -
register
static void register(Block block, Fluid fluid, int totalAmount, @Nullable @Nullable IntegerProperty levelProperty) Do not try to call, use theRegisterCauldronFluidContentEventevent instead. -
registerCapabilities
-