Class ColouredFluidVolume

java.lang.Object
alexiil.mc.lib.attributes.fluid.volume.FluidVolume
alexiil.mc.lib.attributes.fluid.volume.ColouredFluidVolume
Direct Known Subclasses:
BiomeSourcedFluidVolume

public class ColouredFluidVolume extends FluidVolume
A fluid volume that stores it's colours as 4 floats: red, green, blue, and alpha. (Alpha bounds for blending can be configured in the fluid key).
  • Constructor Details

    • ColouredFluidVolume

      public ColouredFluidVolume(ColouredFluidKey key, FluidAmount amount)
    • ColouredFluidVolume

      @Deprecated public ColouredFluidVolume(ColouredFluidKey key, int amount)
      Deprecated.
    • ColouredFluidVolume

      public ColouredFluidVolume(ColouredFluidKey key, net.minecraft.nbt.NbtCompound tag)
    • ColouredFluidVolume

      public ColouredFluidVolume(ColouredFluidKey key, com.google.gson.JsonObject json) throws com.google.gson.JsonSyntaxException
      Throws:
      com.google.gson.JsonSyntaxException
  • Method Details

    • toTag

      public net.minecraft.nbt.NbtCompound toTag(net.minecraft.nbt.NbtCompound nbt)
      Overrides:
      toTag in class FluidVolume
    • toJson

      public com.google.gson.JsonObject toJson()
      Overrides:
      toJson in class FluidVolume
    • fromMcBufferInternal

      protected void fromMcBufferInternal(net.minecraft.network.PacketByteBuf buffer)
      Overrides:
      fromMcBufferInternal in class FluidVolume
    • toMcBufferInternal

      protected void toMcBufferInternal(net.minecraft.network.PacketByteBuf buffer)
      Overrides:
      toMcBufferInternal in class FluidVolume
    • getFluidKey

      public ColouredFluidKey getFluidKey()
      Overrides:
      getFluidKey in class FluidVolume
      Returns:
      The FluidKey for this volume. Subclasses may override this to use a return type for their key class.
    • getName

      public net.minecraft.text.Text getName()
      Overrides:
      getName in class FluidVolume
    • getNoncolouredName

      public net.minecraft.text.Text getNoncolouredName()
    • getRed

      public float getRed()
    • getGreen

      public float getGreen()
    • getBlue

      public float getBlue()
    • getAlpha

      public float getAlpha()
    • getRenderColor

      public int getRenderColor()
      Overrides:
      getRenderColor in class FluidVolume
      Returns:
      The colour tint to use when rendering this fluid volume in gui's or in-world. Note that this MUST be in 0xAA_RR_GG_BB format: (r << 16) | (g << 8) | (b). Alpha may be omitted however - which should default it to 0xFF.
    • asArgb

      public final int asArgb()
    • setArgb

      public void setArgb(int argb)
    • setAbgr

      public void setAbgr(int abgr)
    • setRgb

      public void setRgb(float red, float green, float blue)
      Changes the red, green, and blue colours, leaving alpha unchanged.
    • setRgba

      public void setRgba(float red, float green, float blue, float alpha)
    • copy0

      protected ColouredFluidVolume copy0()
      Overrides:
      copy0 in class FluidVolume
    • split0

      protected FluidVolume split0(FluidAmount toTake, RoundingMode rounding)
      Overrides:
      split0 in class FluidVolume
      Parameters:
      toTake - A valid subtractable amount.
      Returns:
      A new FluidVolume with the given amount that has been removed from this.
    • mergeInternal

      protected void mergeInternal(FluidVolume other, FluidAmount.FluidMergeResult mergedAmounts)
      Description copied from class: FluidVolume
      Actually merges two FluidVolume's together. Only FluidVolume.merge(FluidVolume, FluidMergeRounding, Simulation) should call this. (Except for subclasses that override this method).
      Overrides:
      mergeInternal in class FluidVolume
      Parameters:
      other - The other fluid volume. This will always be the same class as this. This should change the amount of the other fluid to FluidAmount.FluidMergeResult.excess.
    • addTooltipExtras

      public void addTooltipExtras(FluidTooltipContext context, List<net.minecraft.text.Text> tooltip)
      Description copied from class: FluidVolume
      Adds any additional data that this FluidVolume has.
      Overrides:
      addTooltipExtras in class FluidVolume