Record Class AutoSmeltEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.AutoSmeltEffect
- Record Components:
additionalToolUsage- TheLevelBasedValuespecifying 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
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the extra tool durability cost per smelted drop.static final com.mojang.serialization.Codec<AutoSmeltEffect> Codec for serializing and deserializingAutoSmeltEffectinstances from JSON.static final StringJSON field key for enabling or disabling smelting experience drops.static final StringRegistry path identifier for this effect component.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
Constructor Summary
ConstructorsConstructorDescriptionAutoSmeltEffect(net.minecraft.world.item.enchantment.LevelBasedValue additionalToolUsage, boolean dropXp) Creates an instance of aAutoSmeltEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.enchantment.LevelBasedValueReturns the value of theadditionalToolUsagerecord component.booleandropXp()Returns the value of thedropXprecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
ADDITIONAL_TOOL_USAGE
JSON field key for the extra tool durability cost per smelted drop.- See Also:
-
DROP_XP
JSON field key for enabling or disabling smelting experience drops.- See Also:
-
KEY
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
Codec for serializing and deserializingAutoSmeltEffectinstances from JSON.
-
-
Constructor Details
-
AutoSmeltEffect
public AutoSmeltEffect(net.minecraft.world.item.enchantment.LevelBasedValue additionalToolUsage, boolean dropXp) Creates an instance of aAutoSmeltEffectrecord class.- Parameters:
additionalToolUsage- the value for theadditionalToolUsagerecord componentdropXp- the value for thedropXprecord component
-
-
Method Details
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
additionalToolUsage
public net.minecraft.world.item.enchantment.LevelBasedValue additionalToolUsage()Returns the value of theadditionalToolUsagerecord component.- Returns:
- the value of the
additionalToolUsagerecord component
-
dropXp
-