类 FluidIngredient
- 所有已实现的接口:
Predicate<FluidStack>
- 直接已知子类:
CompoundFluidIngredient
,CustomDisplayFluidIngredient
,DataComponentFluidIngredient
,DifferenceFluidIngredient
,IntersectionFluidIngredient
,SimpleFluidIngredient
Ingredient
,
that is, a representation of both a predicate to test
FluidStack
s against, and a list of matching stacks
for e.g. display purposes.
The most common use for fluid ingredients is found in modded recipe inputs,
for example crafting mechanics accepting a list of different fluids;
since those mechanics even rely on a certain amount of a fluid being present,
and fluid ingredients inherently do not hold any information with respect to fluid amount;
you may also want to take a look at SizedFluidIngredient
!
-
字段概要
字段修饰符和类型字段说明static final com.mojang.serialization.Codec
<FluidIngredient> static final StreamCodec
<RegistryFriendlyByteBuf, Optional<FluidIngredient>> static final StreamCodec
<RegistryFriendlyByteBuf, FluidIngredient> -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明display()
返回 a slot display for this ingredient, used for display on the client-side。static SlotDisplay
displayForSingleFluid
(Holder<Fluid> holder) abstract boolean
fluids()
返回 a cached list of all Fluid holders that this ingredient accepts。返回 a stream of fluids accepted by this ingredient。abstract FluidIngredientType
<?> getType()
返回 The type of this fluid ingredient.。abstract int
hashCode()
abstract boolean
isSimple()
Returns whether this fluid ingredient always requires direct stack testing.static FluidIngredient
static FluidIngredient
static FluidIngredient
static FluidIngredient
of
(FluidStack... fluids) abstract boolean
test
(FluidStack fluidStack) Checks if a given fluid stack matches this ingredient.
-
字段详细资料
-
CODEC
-
STREAM_CODEC
-
OPTIONAL_STREAM_CODEC
public static final StreamCodec<RegistryFriendlyByteBuf,Optional<FluidIngredient>> OPTIONAL_STREAM_CODEC -
fluids
-
-
构造器详细资料
-
FluidIngredient
public FluidIngredient()
-
-
方法详细资料
-
fluids
返回 a cached list of all Fluid holders that this ingredient accepts。 This list is immutable and thus can and should not be modified by the caller!- 返回:
- a cached list of all Fluid holders that this ingredient accepts
- 另请参阅:
-
test
Checks if a given fluid stack matches this ingredient. The stack must not be modified in any way.- 指定者:
test
在接口中Predicate<FluidStack>
- 参数:
fluidStack
- the stack to test- 返回:
true
if the stack matches,false
otherwise
-
generateFluids
返回 a stream of fluids accepted by this ingredient。For compatibility reasons, implementations should follow the same guidelines as for custom item ingredients, i.e.:
- Returned fluids are generally used for display purposes, and need not be exhaustive or perfectly accurate, as ingredients may additionally filter by e.g. data component values.
- An exception is ingredients that are simple,
for which it is important that this stream corresponds exactly all fluids accepted by
test(FluidStack)
! - At least one stack should always be returned, so that the ingredient is not considered empty. Empty ingredients may invalidate recipes!
Note: no caching needs to be done by the implementation, this is already handled by
fluids
!- 返回:
- a stream of all fluid stacks this ingredient accepts.
Note: No guarantees are made as to the amount of the fluid, as FluidIngredients are generally not meant to match by amount and these stacks are mostly used for display.
- 另请参阅:
-
display
返回 a slot display for this ingredient, used for display on the client-side。- 返回:
- a slot display for this ingredient, used for display on the client-side
- 另请参阅:
- Implementation Note:
- The default implementation just constructs a list of stacks from
fluids()
. This is generally suitable forsimple
ingredients. Non-simple ingredients can either override this method to provide a more customized display, or let data pack writers useCustomDisplayFluidIngredient
to override the display of an ingredient.
-
isSimple
public abstract boolean isSimple()Returns whether this fluid ingredient always requires direct stack testing.- 返回:
true
if this ingredient ignores NBT data when matching stacks,false
otherwise- 另请参阅:
-
getType
返回 The type of this fluid ingredient.。The type must be registered to
NeoForgeRegistries.FLUID_INGREDIENT_TYPES
.- 返回:
- The type of this fluid ingredient.
-
hashCode
public abstract int hashCode() -
equals
-
displayForSingleFluid
-
of
-
of
-
of
-
of
-