Record Class TransparencyEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.TransparencyEffect
- Record Components:
alphaMultiplier- TheLevelBasedValuealpha opacity multiplier (from0.0fully invisible to1.0fully opaque).detectionMitigation- An optionalLevelBasedValue(from0.0to1.0) reducing how much an equipped armor piece contributes toLivingEntity.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
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the visual alpha opacity multiplier.static final com.mojang.serialization.Codec<TransparencyEffect> Codec for serializing and deserializingTransparencyEffectinstances from JSON.static final StringJSON field key for the mob detection mitigation factor.static final StringRegistry path identifier for this effect component.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
Constructor Summary
ConstructorsConstructorDescriptionTransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier) Constructs a purely visualTransparencyEffectwithout mob detection mitigation.TransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier, Optional<net.minecraft.world.item.enchantment.LevelBasedValue> detectionMitigation) Creates an instance of aTransparencyEffectrecord class.TransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier, net.minecraft.world.item.enchantment.LevelBasedValue detectionMitigation) Constructs aTransparencyEffectwith both visual alpha scaling and mob detection mitigation. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thealphaMultiplierrecord component.Optional<net.minecraft.world.item.enchantment.LevelBasedValue> Returns the value of thedetectionMitigationrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
ALPHA_MULTIPLIER
JSON field key for the visual alpha opacity multiplier.- See Also:
-
DETECTION_MITIGATION
JSON field key for the mob detection mitigation factor.- See Also:
-
KEY
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
Codec for serializing and deserializingTransparencyEffectinstances from JSON.
-
-
Constructor Details
-
TransparencyEffect
public TransparencyEffect(net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier, net.minecraft.world.item.enchantment.LevelBasedValue detectionMitigation) Constructs aTransparencyEffectwith 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 visualTransparencyEffectwithout 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 aTransparencyEffectrecord class.- Parameters:
alphaMultiplier- the value for thealphaMultiplierrecord componentdetectionMitigation- the value for thedetectionMitigationrecord 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). -
alphaMultiplier
public net.minecraft.world.item.enchantment.LevelBasedValue alphaMultiplier()Returns the value of thealphaMultiplierrecord component.- Returns:
- the value of the
alphaMultiplierrecord component
-
detectionMitigation
Returns the value of thedetectionMitigationrecord component.- Returns:
- the value of the
detectionMitigationrecord component
-