Record Class FluidFogDensityEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.FluidFogDensityEffect
Record Components:
fluids - A set of fluid tags or IDs that this effect should apply to (e.g., #minecraft:water).
fogStart - A LevelBasedValue to calculate the start distance of the fog.
fogEndMultiplier - A LevelBasedValue to calculate a multiplier for the view distance which determines the final end distance of the fog.

public record FluidFogDensityEffect(net.minecraft.core.HolderSet<net.minecraft.world.level.material.Fluid> fluids, net.minecraft.world.item.enchantment.LevelBasedValue fogStart, net.minecraft.world.item.enchantment.LevelBasedValue fogEndMultiplier) extends Record
A data-driven record defining an enchantment component effect that modifies fog/visibility when the player is submerged in certain fluids.

This is primarily used by head armor enchantments to clear underwater or lava visibility beyond the vanilla range by adjusting the shader fog start and end distances in FogRendererMixin.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<FluidFogDensityEffect>
    The codec responsible for serializing and deserializing instances of this record from data files (e.g., JSON).
    static final String
    JSON field key for the set of fluids affected by this fog modifier.
    static final String
    JSON field key for the view-distance multiplier governing shader fog end distance.
    static final String
    JSON field key for the shader fog start distance.
    static final String
    Registry path identifier for this effect component.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FluidFogDensityEffect(net.minecraft.core.HolderSet<net.minecraft.world.level.material.Fluid> fluids, net.minecraft.world.item.enchantment.LevelBasedValue fogStart, net.minecraft.world.item.enchantment.LevelBasedValue fogEndMultiplier)
    Creates an instance of a FluidFogDensityEffect record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.core.HolderSet<net.minecraft.world.level.material.Fluid>
    Returns the value of the fluids record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the fogEndMultiplier record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the fogStart record component.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

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

    • FLUIDS

      public static final String FLUIDS
      JSON field key for the set of fluids affected by this fog modifier.
      See Also:
    • FOG_START

      public static final String FOG_START
      JSON field key for the shader fog start distance.
      See Also:
    • FOG_END_MULTIPLIER

      public static final String FOG_END_MULTIPLIER
      JSON field key for the view-distance multiplier governing shader fog end distance.
      See Also:
    • KEY

      public static final String KEY
      Registry path identifier for this effect component.
      See Also:
    • KEY_PROVIDER

      public static final LevelBasedKeyProvider KEY_PROVIDER
      Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    • CODEC

      public static final com.mojang.serialization.Codec<FluidFogDensityEffect> CODEC
      The codec responsible for serializing and deserializing instances of this record from data files (e.g., JSON).

      It uses RegistryCodecs.holderSet(ResourceKey, Codec) to properly handle the HolderSet of fluids.

  • Constructor Details

    • FluidFogDensityEffect

      public FluidFogDensityEffect(net.minecraft.core.HolderSet<net.minecraft.world.level.material.Fluid> fluids, net.minecraft.world.item.enchantment.LevelBasedValue fogStart, net.minecraft.world.item.enchantment.LevelBasedValue fogEndMultiplier)
      Creates an instance of a FluidFogDensityEffect record class.
      Parameters:
      fluids - the value for the fluids record component
      fogStart - the value for the fogStart record component
      fogEndMultiplier - the value for the fogEndMultiplier record component
  • Method Details

    • 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.
    • fluids

      public net.minecraft.core.HolderSet<net.minecraft.world.level.material.Fluid> fluids()
      Returns the value of the fluids record component.
      Returns:
      the value of the fluids record component
    • fogStart

      public net.minecraft.world.item.enchantment.LevelBasedValue fogStart()
      Returns the value of the fogStart record component.
      Returns:
      the value of the fogStart record component
    • fogEndMultiplier

      public net.minecraft.world.item.enchantment.LevelBasedValue fogEndMultiplier()
      Returns the value of the fogEndMultiplier record component.
      Returns:
      the value of the fogEndMultiplier record component