Record Class TransparencyEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.TransparencyEffect
Record Components:
alphaMultiplier - The LevelBasedValue alpha opacity multiplier (from 0.0 fully invisible to 1.0 fully opaque).
detectionMitigation - An optional LevelBasedValue (from 0.0 to 1.0) reducing how much an equipped armor piece contributes to LivingEntity.getArmorCoverPercentage().

public record TransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier, Optional<net.minecraft.world.item.enchantment.LevelBasedValue> detectionMitigation) extends Record
Data-driven enchantment effect component that controls the visual rendering opacity of enchanted items, armor pieces, Elytra, shields, and tridents, as well as optionally reducing mob armor-visibility detection.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    JSON field key for the visual alpha opacity multiplier.
    static final com.mojang.serialization.Codec<TransparencyEffect>
    Codec for serializing and deserializing TransparencyEffect instances from JSON.
    static final String
    JSON field key for the mob detection mitigation factor.
    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
    TransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier)
    Constructs a purely visual TransparencyEffect without mob detection mitigation.
    TransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier, Optional<net.minecraft.world.item.enchantment.LevelBasedValue> detectionMitigation)
    Creates an instance of a TransparencyEffect record class.
    TransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier, net.minecraft.world.item.enchantment.LevelBasedValue detectionMitigation)
    Constructs a TransparencyEffect with both visual alpha scaling and mob detection mitigation.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the alphaMultiplier record component.
    Optional<net.minecraft.world.item.enchantment.LevelBasedValue>
    Returns the value of the detectionMitigation record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    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

    • ALPHA_MULTIPLIER

      public static final String ALPHA_MULTIPLIER
      JSON field key for the visual alpha opacity multiplier.
      See Also:
    • DETECTION_MITIGATION

      public static final String DETECTION_MITIGATION
      JSON field key for the mob detection mitigation factor.
      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<TransparencyEffect> CODEC
      Codec for serializing and deserializing TransparencyEffect instances from JSON.
  • Constructor Details

    • TransparencyEffect

      public TransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier, net.minecraft.world.item.enchantment.LevelBasedValue detectionMitigation)
      Constructs a TransparencyEffect with both visual alpha scaling and mob detection mitigation.
      Parameters:
      alphaMultiplier - The visual alpha opacity multiplier.
      detectionMitigation - The armor visibility detection mitigation factor.
    • TransparencyEffect

      public TransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier)
      Constructs a purely visual TransparencyEffect without mob detection mitigation.
      Parameters:
      alphaMultiplier - The visual alpha opacity multiplier.
    • TransparencyEffect

      public TransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier, Optional<net.minecraft.world.item.enchantment.LevelBasedValue> detectionMitigation)
      Creates an instance of a TransparencyEffect record class.
      Parameters:
      alphaMultiplier - the value for the alphaMultiplier record component
      detectionMitigation - the value for the detectionMitigation 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.
    • alphaMultiplier

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

      public Optional<net.minecraft.world.item.enchantment.LevelBasedValue> detectionMitigation()
      Returns the value of the detectionMitigation record component.
      Returns:
      the value of the detectionMitigation record component