Record Class StreakEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.StreakEffect
- Record Components:
maxStreak- TheLevelBasedValueceiling on the accumulated streak counter.increment- TheLevelBasedValuebonus 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
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<StreakEffect> Codec for serializing and deserializingStreakEffectinstances from JSON.static final StringRegistry path identifier for the combat damage streak component.static final StringJSON field key for the per-stack bonus multiplier increment.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the maximum streak cap.static final StringRegistry path identifier for the block mining streak component.static final StringJSON field key for the streak expiration timeout in ticks. -
Constructor Summary
ConstructorsConstructorDescriptionStreakEffect(net.minecraft.world.item.enchantment.LevelBasedValue maxStreak, net.minecraft.world.item.enchantment.LevelBasedValue increment, int timeoutTicks) Creates an instance of aStreakEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of theincrementrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of themaxStreakrecord component.intReturns the value of thetimeoutTicksrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
MAX_STREAK
JSON field key for the maximum streak cap.- See Also:
-
INCREMENT
JSON field key for the per-stack bonus multiplier increment.- See Also:
-
TIMEOUT_TICKS
JSON field key for the streak expiration timeout in ticks.- See Also:
-
MINING_STREAK_KEY
Registry path identifier for the block mining streak component.- See Also:
-
DAMAGE_STREAK_KEY
Registry path identifier for the combat damage streak component.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
Codec for serializing and deserializingStreakEffectinstances 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 aStreakEffectrecord class.- Parameters:
maxStreak- the value for themaxStreakrecord componentincrement- the value for theincrementrecord componenttimeoutTicks- the value for thetimeoutTicksrecord component
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
maxStreak
public net.minecraft.world.item.enchantment.LevelBasedValue maxStreak()Returns the value of themaxStreakrecord component.- Returns:
- the value of the
maxStreakrecord component
-
increment
public net.minecraft.world.item.enchantment.LevelBasedValue increment()Returns the value of theincrementrecord component.- Returns:
- the value of the
incrementrecord component
-
timeoutTicks
public int timeoutTicks()Returns the value of thetimeoutTicksrecord component.- Returns:
- the value of the
timeoutTicksrecord component
-