Interface OnyxItem

All Known Implementing Classes:
OnyxItemImpl

public interface OnyxItem
  • Method Summary

    Modifier and Type
    Method
    Description
    baseItem(Material material)
    Sets the underlying vanilla material for this item.
    Generates a single ItemStack representing this custom item.
    create(int amount)
    Generates a stack of this custom item.
    Sets the display name using a legacy string with no italics.
    displayName(net.kyori.adventure.text.Component component)
    Sets the display name using an Adventure Component.
    itemMeta(Consumer<ItemMeta> metaConsumer)
    Provides direct access to the ItemMeta for complex modifications.
    Sets the relative path to the texture file, WITHOUT the .png extension.
  • Method Details

    • baseItem

      OnyxItem baseItem(Material material)
      Sets the underlying vanilla material for this item. Required for the item to be created.
      Parameters:
      material - The base vanilla Material.
      Returns:
      This OnyxItem instance.
    • displayName

      OnyxItem displayName(String name)
      Sets the display name using a legacy string with no italics.
      Parameters:
      name - The display name.
      Returns:
      This OnyxItem instance.
    • displayName

      OnyxItem displayName(net.kyori.adventure.text.Component component)
      Sets the display name using an Adventure Component.
      Parameters:
      component - The display name component.
      Returns:
      This OnyxItem instance.
    • texture

      OnyxItem texture(String path)
      Sets the relative path to the texture file, WITHOUT the .png extension. The path is relative to assets//textures/ in your plugin jar.

      Example: texture("items/strawberry") -> assets/myplugin/textures/items/strawberry.png

      Parameters:
      path - The path without extension (e.g., "items/strawberry")
      Returns:
      This OnyxItem instance.
    • itemMeta

      OnyxItem itemMeta(Consumer<ItemMeta> metaConsumer)
      Provides direct access to the ItemMeta for complex modifications.
      Parameters:
      metaConsumer - A consumer to manipulate the item's meta.
      Returns:
      This OnyxItem instance.
    • create

      ItemStack create()
      Generates a single ItemStack representing this custom item. Automatically applies CustomModelData and PDC tags.
      Returns:
      A new ItemStack.
      Throws:
      IllegalStateException - If baseItem is not defined.
    • create

      ItemStack create(int amount)
      Generates a stack of this custom item. Automatically applies CustomModelData and PDC tags.
      Parameters:
      amount - The size of the stack.
      Returns:
      A new ItemStack.
      Throws:
      IllegalStateException - If baseItem is not defined.