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- ALevelBasedValueto calculate the start distance of the fog.fogEndMultiplier- ALevelBasedValueto 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
FieldsModifier and TypeFieldDescriptionstatic 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 StringJSON field key for the set of fluids affected by this fog modifier.static final StringJSON field key for the view-distance multiplier governing shader fog end distance.static final StringJSON field key for the shader fog start distance.static final StringRegistry path identifier for this effect component.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
Constructor Summary
ConstructorsConstructorDescriptionFluidFogDensityEffect(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 aFluidFogDensityEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.net.minecraft.core.HolderSet<net.minecraft.world.level.material.Fluid> fluids()Returns the value of thefluidsrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thefogEndMultiplierrecord component.net.minecraft.world.item.enchantment.LevelBasedValuefogStart()Returns the value of thefogStartrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
FLUIDS
JSON field key for the set of fluids affected by this fog modifier.- See Also:
-
FOG_START
-
FOG_END_MULTIPLIER
JSON field key for the view-distance multiplier governing shader fog end distance.- See Also:
-
KEY
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
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 theHolderSetof 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 aFluidFogDensityEffectrecord class.- Parameters:
fluids- the value for thefluidsrecord componentfogStart- the value for thefogStartrecord componentfogEndMultiplier- the value for thefogEndMultiplierrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
fluids
-
fogStart
-
fogEndMultiplier
public net.minecraft.world.item.enchantment.LevelBasedValue fogEndMultiplier()Returns the value of thefogEndMultiplierrecord component.- Returns:
- the value of the
fogEndMultiplierrecord component
-