Class FluidBase
- All Implemented Interfaces:
net.minecraft.world.level.ItemLike, Registerable
Registerable that registers a fluid type, source and flowing fluid,
a liquid block and a bucket item.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface Registerable
Registerable.EntryCollector -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal net.minecraft.world.item.ItemasItem()protected ClientExtensionInfo.FluidcreateClientInfo(net.minecraft.resources.Identifier id) Creates theclient extensionsand thefluid modelfor this fluid.static FluidBase.BuilderCreates a new fluid builder for setting the basic fluid properties to be passed in the constructor.final net.minecraft.world.item.BucketItemGets thebucket itemfor thisFluidBase.final net.minecraft.world.level.material.FluidGets theflowing fluidfor thisFluidBase.final net.minecraft.world.level.material.FluidgetFluid()Gets thesource fluidfor thisFluidBase.final net.neoforged.neoforge.fluids.FluidTypeGets thefluid typefor thisFluidBase.final net.minecraft.world.level.block.LiquidBlockGets theliquid blockfor thisFluidBase.final net.minecraft.world.level.material.FluidGets thesource fluidfor thisFluidBase.voidregisterAdditional(RegistrationContext ctx, Registerable.EntryCollector builder) Registers additional objects.voidSimilar toRegisterable.registerAdditional(RegistrationContext, EntryCollector)but only invoked on the client.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Registerable
setupClient, setupCommon
-
Field Details
-
mod
-
-
Constructor Details
-
FluidBase
-
-
Method Details
-
createClientInfo
Creates theclient extensionsand thefluid modelfor this fluid. The default implementation creates client extensions that have no special properties and a fluid model without tint that uses a still texture located at[namespace]:block/[path]and a flowing texture located at[namespace]:block/[path]_flowing. -
registerAdditional
@OverridingMethodsMustInvokeSuper public void registerAdditional(RegistrationContext ctx, Registerable.EntryCollector builder) Description copied from interface:RegisterableRegisters additional objects. Those may beRegisterableas well. These objects will be registered with the id of this object and optionally a name suffix.- Specified by:
registerAdditionalin interfaceRegisterable
-
registerClientAdditional
@OverridingMethodsMustInvokeSuper public void registerClientAdditional(RegistrationContext ctx, Registerable.EntryCollector builder) Description copied from interface:RegisterableSimilar toRegisterable.registerAdditional(RegistrationContext, EntryCollector)but only invoked on the client.- Specified by:
registerClientAdditionalin interfaceRegisterable
-
getFluidType
-
getFluid
Gets thesource fluidfor thisFluidBase. This is the same asgetSourceFluid(). One should prefer this method overgetSourceFluid()when needing a representative for the wholefluid type, for example when creatingfluid stacks. -
getSourceFluid
Gets thesource fluidfor thisFluidBase. This is the same asgetFluid(). One should prefer this method overgetFluid()when a distinction between source and flowing fluids is to be made. -
getFlowingFluid
-
getLiquidBlock
Gets theliquid blockfor thisFluidBase.The liquid block is created during registration, as its id is not known before. Therefore, this method must not be called during construction or static initialization of the
FluidBaseand will throw anIllegalStateExceptionuntil the fluid has been registered. It is however safe to pass a method reference to this method around, as long as it is only invoked after registration.- Throws:
IllegalStateException- if thisFluidBasehas not been registered yet
-
getBucketItem
Gets thebucket itemfor thisFluidBase.The bucket item is created during registration, as its id is not known before. Therefore, this method must not be called during construction or static initialization of the
FluidBaseand will throw anIllegalStateExceptionuntil the fluid has been registered. It is however safe to pass a method reference to this method around, as long as it is only invoked after registration.- Throws:
IllegalStateException- if thisFluidBasehas not been registered yet
-
asItem
This is the same asgetBucketItem()and allowsFluidBaseto be used as anItemLike.Just like
getBucketItem(), this throws anIllegalStateExceptionif the fluid has not been registered yet, so aFluidBasemust not be used as anItemLikebefore registration.- Specified by:
asItemin interfacenet.minecraft.world.level.ItemLike- Throws:
IllegalStateException- if thisFluidBasehas not been registered yet
-
fluidBuilder
Creates a new fluid builder for setting the basic fluid properties to be passed in the constructor.
-