Record Class FluidLook

java.lang.Object
java.lang.Record
fr.robie.machineengine.api.resource.fluid.FluidLook
Record Components:
still - the still texture, or null for water's
flow - the flowing texture, or null for water's
tint - color multiplied over the texture (0xRRGGBB); null: the fluid's menu color without a texture, white with one
opacity - 0 (invisible) to 1 (opaque); water is about 0.7
glow - 0 to 1: how much it ignores darkness (1 = fully lit, like a light source)
fog - underwater fog color (0xRRGGBB), or null for the tint's
frameTime - ticks per animation frame, 1 or more (water: 2)

public record FluidLook(@Nullable FluidTexture still, @Nullable FluidTexture flow, @Nullable Integer tint, double opacity, double glow, @Nullable Integer fog, int frameTime) extends Record
How a placed fluid looks. Without textures it is drawn with the vanilla water texture tinted with tint() (or the fluid's menu color): such a fluid needs no texture of its own. Fluids that look the same share one look in the client (docs/FLUID_TYPES_PLAN.md ยง2.2).

Textures, tint, opacity and glow apply after the pack is rebuilt; the fog after players rejoin (it is sent with the world's biomes at login).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final FluidLook
    Water's texture with the fluid's color.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FluidLook(@Nullable FluidTexture still, @Nullable FluidTexture flow, @Nullable Integer tint, double opacity, double glow, @Nullable Integer fog, int frameTime)
    Creates an instance of a FluidLook record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    @Nullable FluidTexture
    Returns the value of the flow record component.
    @Nullable Integer
    fog()
    Returns the value of the fog record component.
    int
    fogFor(@Nullable Integer color)
    The fog to use, for a fluid whose menu color is color (or null).
    int
    Returns the value of the frameTime record component.
    double
    Returns the value of the glow record component.
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the opacity record component.
    @Nullable FluidTexture
    Returns the value of the still record component.
    boolean
    Whether the fluid has a texture of its own (it then takes a tile in the texture grid).
    @Nullable Integer
    Returns the value of the tint record component.
    int
    tintFor(@Nullable Integer color)
    The tint to draw with, for a fluid whose menu color is color (or null).
    final String
    Returns a string representation of this record class.
    @NotNull FluidLook
    withTint(@Nullable Integer value)
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • TINTED_WATER

      public static final FluidLook TINTED_WATER
      Water's texture with the fluid's color.
  • Constructor Details

    • FluidLook

      public FluidLook(@Nullable @Nullable FluidTexture still, @Nullable @Nullable FluidTexture flow, @Nullable @Nullable Integer tint, double opacity, double glow, @Nullable @Nullable Integer fog, int frameTime)
      Creates an instance of a FluidLook record class.
      Parameters:
      still - the value for the still record component
      flow - the value for the flow record component
      tint - the value for the tint record component
      opacity - the value for the opacity record component
      glow - the value for the glow record component
      fog - the value for the fog record component
      frameTime - the value for the frameTime record component
  • Method Details

    • textured

      public boolean textured()
      Whether the fluid has a texture of its own (it then takes a tile in the texture grid).
    • tintFor

      public int tintFor(@Nullable @Nullable Integer color)
      The tint to draw with, for a fluid whose menu color is color (or null).
    • fogFor

      public int fogFor(@Nullable @Nullable Integer color)
      The fog to use, for a fluid whose menu color is color (or null).
    • withTint

      @NotNull public @NotNull FluidLook withTint(@Nullable @Nullable Integer value)
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • still

      @Nullable public @Nullable FluidTexture still()
      Returns the value of the still record component.
      Returns:
      the value of the still record component
    • flow

      @Nullable public @Nullable FluidTexture flow()
      Returns the value of the flow record component.
      Returns:
      the value of the flow record component
    • tint

      @Nullable public @Nullable Integer tint()
      Returns the value of the tint record component.
      Returns:
      the value of the tint record component
    • opacity

      public double opacity()
      Returns the value of the opacity record component.
      Returns:
      the value of the opacity record component
    • glow

      public double glow()
      Returns the value of the glow record component.
      Returns:
      the value of the glow record component
    • fog

      @Nullable public @Nullable Integer fog()
      Returns the value of the fog record component.
      Returns:
      the value of the fog record component
    • frameTime

      public int frameTime()
      Returns the value of the frameTime record component.
      Returns:
      the value of the frameTime record component