Record Class MultiplyByBlockStateBonus
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.theme.power.bonus.MultiplyByBlockStateBonus
- Record Components:
property- The name of theIntegerPropertyto check on the block state (e.g.,"candles").
- All Implemented Interfaces:
PowerBonus
A data-driven
PowerBonus implementation that multiplies the base enchanting power
by the integer value of a specified block state property.
Designed to model variable power sources, such as multiplying the base power provided by a candle
by the number of candles in a cluster using the "candles" integer block state property.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<MultiplyByBlockStateBonus> The codec responsible for serializing and deserializing instances of this record from JSON. -
Constructor Summary
ConstructorsConstructorDescriptionMultiplyByBlockStateBonus(String property) Creates an instance of aMultiplyByBlockStateBonusrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.com.mojang.serialization.MapCodec<? extends PowerBonus> getCodec()Retrieves theMapCodecresponsible for encoding and decoding this specific bonus implementation.Retrieves the unique identifier string associated with this specific bonus implementation.final inthashCode()Returns a hash code value for this object.property()Returns the value of thepropertyrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
The codec responsible for serializing and deserializing instances of this record from JSON.
-
-
Constructor Details
-
MultiplyByBlockStateBonus
Creates an instance of aMultiplyByBlockStateBonusrecord class.- Parameters:
property- the value for thepropertyrecord component
-
-
Method Details
-
getTypeId
Retrieves the unique identifier string associated with this specific bonus implementation.- Specified by:
getTypeIdin interfacePowerBonus- Returns:
- The constant ID string for this bonus type:
"multiply_by_block_state".
-
getCodec
Retrieves theMapCodecresponsible for encoding and decoding this specific bonus implementation.- Specified by:
getCodecin interfacePowerBonus- Returns:
- The
MapCodecfor this bonus type.
-
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). -
property
Returns the value of thepropertyrecord component.- Returns:
- the value of the
propertyrecord component
-