Record Class FluidSlotDisplay

java.lang.Object
java.lang.Record
net.neoforged.neoforge.fluids.crafting.display.FluidSlotDisplay
Record Components:
fluid - The fluid to be displayed.
All Implemented Interfaces:
net.minecraft.world.item.crafting.display.SlotDisplay

public record FluidSlotDisplay(net.minecraft.core.Holder<net.minecraft.world.level.material.Fluid> fluid) extends Record implements net.minecraft.world.item.crafting.display.SlotDisplay
Slot display for a single fluid holder.

Note that information on amount and data of the displayed fluid stack depends on the provided factory!

  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.world.item.crafting.display.SlotDisplay

    net.minecraft.world.item.crafting.display.SlotDisplay.AnyFuel, net.minecraft.world.item.crafting.display.SlotDisplay.Composite, net.minecraft.world.item.crafting.display.SlotDisplay.Empty, net.minecraft.world.item.crafting.display.SlotDisplay.ItemSlotDisplay, net.minecraft.world.item.crafting.display.SlotDisplay.ItemStackContentsFactory, net.minecraft.world.item.crafting.display.SlotDisplay.ItemStackSlotDisplay, net.minecraft.world.item.crafting.display.SlotDisplay.SmithingTrimDemoSlotDisplay, net.minecraft.world.item.crafting.display.SlotDisplay.TagSlotDisplay, net.minecraft.world.item.crafting.display.SlotDisplay.Type<T extends net.minecraft.world.item.crafting.display.SlotDisplay>, net.minecraft.world.item.crafting.display.SlotDisplay.WithRemainder
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final net.minecraft.core.Holder<net.minecraft.world.level.material.Fluid>
    The field for the fluid record component.
    static final com.mojang.serialization.MapCodec<FluidSlotDisplay>
     
    static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,FluidSlotDisplay>
     

    Fields inherited from interface net.minecraft.world.item.crafting.display.SlotDisplay

    CODEC
  • Constructor Summary

    Constructors
    Constructor
    Description
    FluidSlotDisplay(net.minecraft.core.Holder<net.minecraft.world.level.material.Fluid> fluid)
    Creates an instance of a FluidSlotDisplay record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.core.Holder<net.minecraft.world.level.material.Fluid>
    Returns the value of the fluid record component.
    final int
    Returns a hash code value for this object.
    <T> Stream<T>
    resolve(net.minecraft.util.context.ContextMap context, net.minecraft.world.item.crafting.display.DisplayContentsFactory<T> factory)
     
    final String
    Returns a string representation of this record class.
    net.minecraft.world.item.crafting.display.SlotDisplay.Type<FluidSlotDisplay>
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.world.item.crafting.display.SlotDisplay

    isEnabled, resolveForFirstStack, resolveForStacks
  • Field Details

    • fluid

      private final net.minecraft.core.Holder<net.minecraft.world.level.material.Fluid> fluid
      The field for the fluid record component.
    • MAP_CODEC

      public static final com.mojang.serialization.MapCodec<FluidSlotDisplay> MAP_CODEC
    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,FluidSlotDisplay> STREAM_CODEC
  • Constructor Details

    • FluidSlotDisplay

      public FluidSlotDisplay(net.minecraft.core.Holder<net.minecraft.world.level.material.Fluid> fluid)
      Creates an instance of a FluidSlotDisplay record class.
      Parameters:
      fluid - the value for the fluid record component
  • Method Details

    • type

      public net.minecraft.world.item.crafting.display.SlotDisplay.Type<FluidSlotDisplay> type()
      Specified by:
      type in interface net.minecraft.world.item.crafting.display.SlotDisplay
    • resolve

      public <T> Stream<T> resolve(net.minecraft.util.context.ContextMap context, net.minecraft.world.item.crafting.display.DisplayContentsFactory<T> factory)
      Specified by:
      resolve in interface net.minecraft.world.item.crafting.display.SlotDisplay
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • fluid

      public net.minecraft.core.Holder<net.minecraft.world.level.material.Fluid> fluid()
      Returns the value of the fluid record component.
      Returns:
      the value of the fluid record component