Record Class AutoSmeltEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.AutoSmeltEffect
Record Components:
additionalToolUsage - The LevelBasedValue specifying extra durability damage incurred per smelted item.
dropXp - Whether smelting recipe experience should be awarded when items are auto-smelted.

public record AutoSmeltEffect(net.minecraft.world.item.enchantment.LevelBasedValue additionalToolUsage, boolean dropXp) extends Record
Data-driven enchantment effect component that automatically smelts block drops using active RecipeType.SMELTING recipes when breaking blocks.

Evaluated during block drop generation in EnchantmentEventsMixin. Supports optional per-smelted-item tool durability penalties and fractional smelting experience accumulation via EnchantmentEffectComponents.STORED_SMELTING_XP.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    JSON field key for the extra tool durability cost per smelted drop.
    static final com.mojang.serialization.Codec<AutoSmeltEffect>
    Codec for serializing and deserializing AutoSmeltEffect instances from JSON.
    static final String
    JSON field key for enabling or disabling smelting experience drops.
    static final String
    Registry path identifier for this effect component.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AutoSmeltEffect(net.minecraft.world.item.enchantment.LevelBasedValue additionalToolUsage, boolean dropXp)
    Creates an instance of a AutoSmeltEffect record class.
  • Method Summary

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

    • ADDITIONAL_TOOL_USAGE

      public static final String ADDITIONAL_TOOL_USAGE
      JSON field key for the extra tool durability cost per smelted drop.
      See Also:
    • DROP_XP

      public static final String DROP_XP
      JSON field key for enabling or disabling smelting experience drops.
      See Also:
    • KEY

      public static final String KEY
      Registry path identifier for this effect 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<AutoSmeltEffect> CODEC
      Codec for serializing and deserializing AutoSmeltEffect instances from JSON.
  • Constructor Details

    • AutoSmeltEffect

      public AutoSmeltEffect(net.minecraft.world.item.enchantment.LevelBasedValue additionalToolUsage, boolean dropXp)
      Creates an instance of a AutoSmeltEffect record class.
      Parameters:
      additionalToolUsage - the value for the additionalToolUsage record component
      dropXp - the value for the dropXp 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 '=='.
      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.
    • additionalToolUsage

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

      public boolean dropXp()
      Returns the value of the dropXp record component.
      Returns:
      the value of the dropXp record component