Record Class StreakEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.StreakEffect
Record Components:
maxStreak - The LevelBasedValue ceiling on the accumulated streak counter.
increment - The LevelBasedValue bonus multiplier added per accumulated streak stack.
timeoutTicks - The number of ticks before an inactive streak resets to zero.

public record StreakEffect(net.minecraft.world.item.enchantment.LevelBasedValue maxStreak, net.minecraft.world.item.enchantment.LevelBasedValue increment, int timeoutTicks) extends Record
Data-driven enchantment effect component that configures consecutive action bonuses for mining identical block types (MINING_STREAK_KEY) or striking identical entity types (DAMAGE_STREAK_KEY).

Each consecutive interaction against the same target identifier increments the entity's streak counter (via StreakStateAccessor) up to maxStreak(), multiplying mining speed or combat damage by 1.0 + (increment * currentStreak) until timeoutTicks() elapses or a different target type is interacted with.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<StreakEffect>
    Codec for serializing and deserializing StreakEffect instances from JSON.
    static final String
    Registry path identifier for the combat damage streak component.
    static final String
    JSON field key for the per-stack bonus multiplier increment.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    static final String
    JSON field key for the maximum streak cap.
    static final String
    Registry path identifier for the block mining streak component.
    static final String
    JSON field key for the streak expiration timeout in ticks.
  • Constructor Summary

    Constructors
    Constructor
    Description
    StreakEffect(net.minecraft.world.item.enchantment.LevelBasedValue maxStreak, net.minecraft.world.item.enchantment.LevelBasedValue increment, int timeoutTicks)
    Creates an instance of a StreakEffect record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the increment record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the maxStreak record component.
    int
    Returns the value of the timeoutTicks record component.
    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

    • MAX_STREAK

      public static final String MAX_STREAK
      JSON field key for the maximum streak cap.
      See Also:
    • INCREMENT

      public static final String INCREMENT
      JSON field key for the per-stack bonus multiplier increment.
      See Also:
    • TIMEOUT_TICKS

      public static final String TIMEOUT_TICKS
      JSON field key for the streak expiration timeout in ticks.
      See Also:
    • MINING_STREAK_KEY

      public static final String MINING_STREAK_KEY
      Registry path identifier for the block mining streak component.
      See Also:
    • DAMAGE_STREAK_KEY

      public static final String DAMAGE_STREAK_KEY
      Registry path identifier for the combat damage streak 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<StreakEffect> CODEC
      Codec for serializing and deserializing StreakEffect instances from JSON.
  • Constructor Details

    • StreakEffect

      public StreakEffect(net.minecraft.world.item.enchantment.LevelBasedValue maxStreak, net.minecraft.world.item.enchantment.LevelBasedValue increment, int timeoutTicks)
      Creates an instance of a StreakEffect record class.
      Parameters:
      maxStreak - the value for the maxStreak record component
      increment - the value for the increment record component
      timeoutTicks - the value for the timeoutTicks 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • maxStreak

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

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

      public int timeoutTicks()
      Returns the value of the timeoutTicks record component.
      Returns:
      the value of the timeoutTicks record component