All Known Implementing Classes:
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

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<PowerBonus>
    The primary codec for serializing and deserializing any implementation of PowerBonus.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.mojang.serialization.MapCodec<? extends PowerBonus>
    Retrieves the MapCodec responsible for encoding and decoding this specific bonus implementation.
    Retrieves the unique identifier string associated with this specific bonus implementation.
  • Field Details

    • CODEC

      static final com.mojang.serialization.Codec<PowerBonus> CODEC
      The primary codec for serializing and deserializing any implementation of PowerBonus.

      Uses a type dispatch mechanism based on the string value of the "type" field in JSON, delegating decoding to the appropriate codec retrieved via PowerBonusType.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 the MapCodec responsible for encoding and decoding this specific bonus implementation.
      Returns:
      The specialized MapCodec for this class.