Class OnyxBlockImpl

java.lang.Object
com.zombienw.onyxlib.impl.block.OnyxBlockImpl
All Implemented Interfaces:
OnyxBlock, OnyxElement

public class OnyxBlockImpl extends Object implements OnyxBlock
Implements OnyxBlocks
  • Constructor Details

  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in interface OnyxElement
      Returns:
      The string identifier of this element (e.g., "marble")
    • getBlockDisplay

      public OnyxBlockDisplay getBlockDisplay()
    • getCustomModelPath

      public String getCustomModelPath()
    • getBaseBlock

      public Material getBaseBlock()
    • getKey

      public NamespacedKey getKey()
      Specified by:
      getKey in interface OnyxElement
      Returns:
      The underlying Bukkit NamespacedKey for this element
    • baseBlock

      public OnyxBlock baseBlock(Material material)
      Description copied from interface: OnyxBlock
      Defines the underlying vanilla Minecraft block underneath this custom block.
      Specified by:
      baseBlock in interface OnyxBlock
      Parameters:
      material - The vanilla block Material to use (must be a placeable block)
      Returns:
      This OnyxBlock instance.
    • displayName

      public OnyxBlock displayName(String name)
      Description copied from interface: OnyxBlock
      Sets the display name using a legacy string with no italics.
      Specified by:
      displayName in interface OnyxBlock
      Parameters:
      name - The display name.
      Returns:
      This OnyxBlock instance.
    • displayName

      public OnyxBlock displayName(net.kyori.adventure.text.Component component)
      Description copied from interface: OnyxBlock
      Sets the display name using an Adventure Component.
      Specified by:
      displayName in interface OnyxBlock
      Parameters:
      component - The display name component.
      Returns:
      This OnyxBlock instance.
    • model

      public OnyxBlock model(@NotNull @NotNull String path)
      Description copied from interface: OnyxBlock
      Sets the relative path to the developer made JSON item model. The path is relative to assets//models/ in your plugin jar.
      Specified by:
      model in interface OnyxBlock
      Parameters:
      path - The path without extension (e.g., "blocks/chair")
      Returns:
      This OnyxBlock instance.
    • blockDisplay

      public OnyxBlock blockDisplay(Consumer<OnyxBlockDisplay> builder)
      Description copied from interface: OnyxBlock
      Configures the visual faces of the custom block using a block display builder. Note: If this method is invoked, all relevant faces of the block must be explicitly defined, otherwise an error will be thrown during resource pack generation.
      Specified by:
      blockDisplay in interface OnyxBlock
      Parameters:
      builder - A consumer managing the texture mappings for the block's faces.
      Returns:
      This OnyxBlock instance.
    • rotates

      public OnyxBlock rotates(boolean rotates)
      Description copied from interface: OnyxBlock
      Determines if the custom block should rotate to face the player upon placement.
      Specified by:
      rotates in interface OnyxBlock
      Parameters:
      rotates - True if the custom block should face the player when placed, false otherwise.
      Returns:
      This OnyxBlock instance.
    • create

      public ItemStack create()
      Description copied from interface: OnyxElement
      Creates a single ItemStack of this element. Automatically applies CustomModelData and PDC tags.
      Specified by:
      create in interface OnyxElement
      Returns:
      The generated ItemStack.
    • create

      public ItemStack create(int amount)
      Description copied from interface: OnyxElement
      Creates an ItemStack of this element with the specified amount. Automatically applies CustomModelData and PDC tags.
      Specified by:
      create in interface OnyxElement
      Parameters:
      amount - The stack size.
      Returns:
      The generated ItemStack.
    • place

      public Block place(Location location)
      Description copied from interface: OnyxBlock
      Places an OnyxBlock at a given location.
      Specified by:
      place in interface OnyxBlock
      Parameters:
      location - The location of the OnyxBlock to be placed.
      Returns:
      The Block after placement.