Record Class MultiplyByBlockStateBonus

java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.theme.power.bonus.MultiplyByBlockStateBonus
Record Components:
property - The name of the IntegerProperty to check on the block state (e.g., "candles").
All Implemented Interfaces:
PowerBonus

public record MultiplyByBlockStateBonus(String property) extends Record implements 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

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<MultiplyByBlockStateBonus>
    The codec responsible for serializing and deserializing instances of this record from JSON.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of a MultiplyByBlockStateBonus record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    com.mojang.serialization.MapCodec<? extends PowerBonus>
    Retrieves the MapCodec responsible for encoding and decoding this specific bonus implementation.
    Retrieves the unique identifier string associated with this specific bonus implementation.
    final int
    Returns a hash code value for this object.
    Returns the value of the property record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<MultiplyByBlockStateBonus> CODEC
      The codec responsible for serializing and deserializing instances of this record from JSON.
  • Constructor Details

    • MultiplyByBlockStateBonus

      public MultiplyByBlockStateBonus(String property)
      Creates an instance of a MultiplyByBlockStateBonus record class.
      Parameters:
      property - the value for the property record component
  • Method Details

    • getTypeId

      public String getTypeId()
      Retrieves the unique identifier string associated with this specific bonus implementation.
      Specified by:
      getTypeId in interface PowerBonus
      Returns:
      The constant ID string for this bonus type: "multiply_by_block_state".
    • getCodec

      public com.mojang.serialization.MapCodec<? extends PowerBonus> getCodec()
      Retrieves the MapCodec responsible for encoding and decoding this specific bonus implementation.
      Specified by:
      getCodec in interface PowerBonus
      Returns:
      The MapCodec for this bonus type.
    • 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.
    • property

      public String property()
      Returns the value of the property record component.
      Returns:
      the value of the property record component