Interface PowerBonus
- All Known Implementing Classes:
AddIfBlockStateBonus,CountItemsInInventoryBonus,MultiplyByBlockStateBonus
public sealed interface PowerBonus
permits AddIfBlockStateBonus, CountItemsInInventoryBonus, MultiplyByBlockStateBonus
A sealed interface representing a conditional bonus applied to the base enchanting power
provided by a single block in an
EnchantmentTheme.
Implementations of this interface define dynamic rules (such as checking block states or counting container inventory items) that modify the final power value.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<PowerBonus> The primary codec for serializing and deserializing any implementation ofPowerBonus. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<? extends PowerBonus> getCodec()Retrieves theMapCodecresponsible for encoding and decoding this specific bonus implementation.Retrieves the unique identifier string associated with this specific bonus implementation.
-
Field Details
-
CODEC
The primary codec for serializing and deserializing any implementation ofPowerBonus.Uses a type dispatch mechanism based on the string value of the
"type"field in JSON, delegating decoding to the appropriate codec retrieved viaPowerBonusType.getCodecById(String).
-
-
Method Details
-
getTypeId
String getTypeId()Retrieves the unique identifier string associated with this specific bonus implementation.- Returns:
- The unique ID string (e.g.,
"add_if_block_state").
-
getCodec
com.mojang.serialization.MapCodec<? extends PowerBonus> getCodec()Retrieves theMapCodecresponsible for encoding and decoding this specific bonus implementation.- Returns:
- The specialized
MapCodecfor this class.
-