Record Class PointerValue
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.value.PointerValue
- Record Components:
id- The unique string key used to reference this value in translation strings (e.g.,<val:id>or<array:id>).value- The underlyingLevelBasedValuedelegated to during calculation and tooltip rendering.
- All Implemented Interfaces:
net.minecraft.world.item.enchantment.LevelBasedValue
public record PointerValue(String id, net.minecraft.world.item.enchantment.LevelBasedValue value)
extends Record
implements net.minecraft.world.item.enchantment.LevelBasedValue
A proxy
LevelBasedValue used to tag and expose mathematical curves inside complex enchantment
JSON structures for dynamic tooltip interpolation.
During data loading, EnchantmentCodecMixin scans the enchantment's DFU tree, extracts each
PointerValue by its id(), and binds its inner value() into the
EnchantmentEffectComponents.DESCRIPTION_ARGS component map
for $\mathcal{O}(1)$ runtime lookup by DynamicDescriptionParser.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.world.item.enchantment.LevelBasedValue
net.minecraft.world.item.enchantment.LevelBasedValue.Clamped, net.minecraft.world.item.enchantment.LevelBasedValue.Constant, net.minecraft.world.item.enchantment.LevelBasedValue.Exponent, net.minecraft.world.item.enchantment.LevelBasedValue.Fraction, net.minecraft.world.item.enchantment.LevelBasedValue.LevelsSquared, net.minecraft.world.item.enchantment.LevelBasedValue.Linear, net.minecraft.world.item.enchantment.LevelBasedValue.Lookup -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<PointerValue> The codec responsible for serializing and deserializingPointerValueinstances from JSON.static final StringRegistry path identifier for this level based value.Fields inherited from interface net.minecraft.world.item.enchantment.LevelBasedValue
DISPATCH_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionPointerValue(String id, net.minecraft.world.item.enchantment.LevelBasedValue value) Creates an instance of aPointerValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfloatcalculate(int level) Delegates calculation directly to the wrappedvalue().@NotNull com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.LevelBasedValue> codec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.final StringtoString()Returns a string representation of this record class.net.minecraft.world.item.enchantment.LevelBasedValuevalue()Returns the value of thevaluerecord component.
-
Field Details
-
KEY
Registry path identifier for this level based value.- See Also:
-
CODEC
The codec responsible for serializing and deserializingPointerValueinstances from JSON.
-
-
Constructor Details
-
Method Details
-
calculate
public float calculate(int level) Delegates calculation directly to the wrappedvalue().- Specified by:
calculatein interfacenet.minecraft.world.item.enchantment.LevelBasedValue- Parameters:
level- The active level of the enchantment.- Returns:
- The calculated float value from the inner provider.
-
codec
@NotNull public @NotNull com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.LevelBasedValue> codec()- Specified by:
codecin interfacenet.minecraft.world.item.enchantment.LevelBasedValue- Returns:
- The
MapCodecfor this class.
-
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. -
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. -
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). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
value
public net.minecraft.world.item.enchantment.LevelBasedValue value()Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-