Class ItemBuilder

java.lang.Object
com.shanebeestudios.coreapi.util.ItemBuilder

public class ItemBuilder extends Object
Build an ItemStack
  • Method Details

    • builder

      public static ItemBuilder builder(@NotNull @NotNull Material material)
      Create a new builder
      Parameters:
      material - Material to create
      Returns:
      New builder
    • builder

      public static ItemBuilder builder(@NotNull @NotNull Material material, int amount)
      Create a new builder
      Parameters:
      material - Material to create
      amount - Amount of ItemStack
      Returns:
      New builder
    • builder

      public static ItemBuilder builder(@NotNull @NotNull ItemType type)
      Create a new builder
      Parameters:
      type - ItemType to create
      Returns:
      New builder
    • builder

      public static ItemBuilder builder(@NotNull @NotNull ItemType type, int amount)
      Create a new builder
      Parameters:
      type - ItemType to create
      amount - Amount of ItemStack
      Returns:
      New builder
    • amount

      public ItemBuilder amount(int amount)
      Modify the amount of this item
      Parameters:
      amount - Amount of item
      Returns:
      Builder
    • name

      public ItemBuilder name(String name)
      Set the name of this item
      Parameters:
      name - Name of item
      Returns:
      Builder
    • lore

      public ItemBuilder lore(List<String> lore)
      Set the lore of this item
      Parameters:
      lore - Lore to set
      Returns:
      Builder
    • addLore

      public ItemBuilder addLore(String lore)
      Add a line of lore to the lore of this item
      Parameters:
      lore - Lore to add
      Returns:
      Builder
    • addEnchant

      public ItemBuilder addEnchant(@NotNull @NotNull Enchantment enchantment, int level)
      Add an enchantment to this item
      Parameters:
      enchantment - Enchantment to add
      level - Level of enchantment to add
      Returns:
      Builder
    • food

      public ItemBuilder food(@NotNull @NotNull Consumer<FoodComponent> food)
      Modify the food component of this item
      Parameters:
      food - Food component to modify
      Returns:
      Builder
    • tool

      public ItemBuilder tool(@NotNull @NotNull Consumer<ToolComponent> tool)
      Modify the tool component of this item
      Parameters:
      tool - Tool component to modify
      Returns:
      Builder
    • meta

      public ItemBuilder meta(@NotNull @NotNull Consumer<ItemMeta> meta)
      Modify the ItemMeta of this item
      Parameters:
      meta - ItemMeta to modify
      Returns:
      Builder
    • vanillaComponent

      public <T> ItemBuilder vanillaComponent(@NotNull @NotNull net.minecraft.core.component.DataComponentType<T> type, @Nullable T value)
      Add a vanilla component to this item
      Type Parameters:
      T - Class type of component
      Parameters:
      type - Type of component to add
      value - Value to add
      Returns:
      Builder
    • vanilla

      public ItemBuilder vanilla(@NotNull @NotNull Consumer<net.minecraft.world.item.ItemStack> vanilla)
      Modify the NMS ItemStack of this item
      Parameters:
      vanilla - NMS ItemStack to modify
      Returns:
      Builder
    • build

      public ItemStack build()
      Build this builder into an ItemStack
      Returns:
      ItemStack from builder