The ItemCreator class provides a powerful and intuitive API for building customized ItemStack objects. It uses a fluent builder pattern for easy chaining of modifications.
Creating items
Basic creation
ItemStack item = ItemCreator.of(CompMaterial.DIAMOND_SWORD)
.name("&6Legendary Sword")
.lore("&7A powerful weapon")
.make();
From existing ItemStack
ItemStack existing = player.getInventory().getItemInMainHand();
ItemStack modified = ItemCreator.of(existing)
.name("&aRenamed Item")
.lore("&7Additional lore line")
.make();
Static factory methods
of(CompMaterial material)
Create a new ItemCreator from a material.ItemCreator creator = ItemCreator.of(CompMaterial.DIAMOND);
of(CompMaterial material, String name, String... lore)
Create an ItemCreator with material, name, and lore. Automatically hides tags.ItemCreator creator = ItemCreator.of(
CompMaterial.DIAMOND_SWORD,
"&6Epic Sword",
"&7Damage: +10",
"&7Speed: +5"
);
Create an ItemCreator from an existing ItemStack.ItemStack existing = new ItemStack(Material.STONE);
ItemCreator creator = ItemCreator.of(existing);
Create a colored wool item.ItemStack redWool = ItemCreator.ofWool(CompColor.RED).make();
ofEgg(EntityType entityType)
Create a spawn egg for the specified entity type.ItemStack creeperEgg = ItemCreator.ofEgg(EntityType.CREEPER)
.name("&aCreeper Egg")
.make();
ofPotion(PotionEffectType potionEffect)
Create a potion with the specified effect.ItemStack speedPotion = ItemCreator.ofPotion(PotionEffectType.SPEED)
.name("&bSpeed Potion")
.make();
Builder methods
Basic properties
material(CompMaterial material)
Set the material of the item.ItemCreator.of(CompMaterial.STONE)
.material(CompMaterial.DIAMOND)
.make();
Set the stack size.ItemCreator.of(CompMaterial.ARROW)
.amount(64)
.make();
Set the damage/durability of the item.ItemCreator.of(CompMaterial.DIAMOND_PICKAXE)
.damage(100)
.make();
Set the display name. Color codes with & are automatically replaced.ItemCreator.of(CompMaterial.DIAMOND)
.name("&b&lRare Diamond")
.make();
Lore
Add lore lines. Color codes are replaced automatically.ItemCreator.of(CompMaterial.SWORD)
.lore("&7Damage: 10")
.lore("&7Durability: 100")
.lore("") // Empty line
.lore("&eRare weapon")
.make();
Add multiple lore lines from a list.List<String> loreLines = Arrays.asList(
"&7Line 1",
"&7Line 2"
);
ItemCreator.of(CompMaterial.BOOK)
.lore(loreLines)
.make();
Remove all existing lore.ItemCreator.of(existingItem)
.clearLore()
.lore("&7New lore")
.make();
Enchantments
enchant(Enchantment enchantment)
Add an enchantment at level 1.ItemCreator.of(CompMaterial.DIAMOND_SWORD)
.enchant(CompEnchantment.SHARPNESS)
.make();
enchant(Enchantment enchantment, int level)
Add an enchantment at a specific level.ItemCreator.of(CompMaterial.DIAMOND_SWORD)
.enchant(CompEnchantment.SHARPNESS, 5)
.enchant(CompEnchantment.FIRE_ASPECT, 2)
.make();
Visual effects
Make the item glow (adds hidden enchantment).ItemCreator.of(CompMaterial.NETHER_STAR)
.name("&6Special Item")
.glow(true)
.make();
Set the color for leather armor or colorable blocks.ItemCreator.of(CompMaterial.LEATHER_CHESTPLATE)
.color(CompColor.RED)
.make();
Set custom model data (MC 1.14+).ItemCreator.of(CompMaterial.STICK)
.name("&6Magic Wand")
.modelData(1001)
.make();
Item flags
flags(CompItemFlag... flags)
Add item flags to hide certain properties.ItemCreator.of(CompMaterial.DIAMOND_SWORD)
.enchant(CompEnchantment.SHARPNESS, 1)
.flags(CompItemFlag.HIDE_ENCHANTS)
.make();
hideTags(boolean hideTags)
Hide all tags (enchantments, attributes, etc.).ItemCreator.of(CompMaterial.DIAMOND_SWORD)
.enchant(CompEnchantment.SHARPNESS, 5)
.hideTags(true)
.make();
unbreakable(boolean unbreakable)
Make the item unbreakable.ItemCreator.of(CompMaterial.DIAMOND_PICKAXE)
.unbreakable(true)
.make();
Skull customization
skullOwner(String skullOwner)
Set the skull owner by player name.ItemCreator.of(CompMaterial.PLAYER_HEAD)
.skullOwner("Notch")
.name("&6Notch's Head")
.make();
skullUrl(String skullUrl)
Set the skull texture from a URL or base64 string.ItemCreator.of(CompMaterial.PLAYER_HEAD)
.skullUrl("http://textures.minecraft.net/texture/...")
.name("&6Custom Head")
.make();
tag(String key, String value)
Add a custom NBT tag to the item.ItemCreator.of(CompMaterial.DIAMOND)
.name("&6Rare Diamond")
.tag("rarity", "legendary")
.tag("item_id", "diamond_rare_001")
.make();
Retrieve tags later using CompMetadata.getMetadata(item, key)
Book customization
bookPages(String... pages)
Set the pages of a book.ItemCreator.of(CompMaterial.WRITTEN_BOOK)
.bookTitle("&6Tutorial")
.bookAuthor("Admin")
.bookPages(
"&6Chapter 1\n\n&7Welcome to the server!",
"&6Chapter 2\n\n&7Here are the rules..."
)
.make();
bookAuthor(String bookAuthor)
Set the author of a book.
bookTitle(String bookTitle)
Set the title of a book.
Building items
Construct the final ItemStack with all specified properties.ItemStack item = ItemCreator.of(CompMaterial.DIAMOND_SWORD)
.name("&6Sword")
.make();
Create an item suitable for menus (all tags hidden, unbreakable).ItemStack menuItem = ItemCreator.of(CompMaterial.COMPASS)
.name("&6Navigation")
.makeMenuTool();
Convenience methods
Add this item directly to a player’s inventory.ItemCreator.of(CompMaterial.DIAMOND)
.name("&6Reward")
.give(player);
Drop this item at a specific location.ItemCreator.of(CompMaterial.GOLD_INGOT)
.amount(10)
.drop(player.getLocation());
Advanced examples
ItemStack menuItem = ItemCreator.of(CompMaterial.CHEST)
.name("&6Storage")
.lore(
"",
"&7Click to open your storage",
"&7Capacity: 54 slots"
)
.glow(true)
.makeMenuTool();
Custom skull with NBT
ItemStack customHead = ItemCreator.of(CompMaterial.PLAYER_HEAD)
.skullUrl("http://textures.minecraft.net/texture/abc123...")
.name("&6Custom NPC")
.lore(
"&7Type: Quest Giver",
"&7Level: 50"
)
.tag("npc_id", "quest_giver_001")
.tag("npc_level", "50")
.makeMenuTool();
ItemStack magicWand = ItemCreator.of(CompMaterial.STICK)
.name("&5&lMagic Wand")
.lore(
"",
"&7Spell Power: 100",
"&7Mana Cost: 20",
"",
"&eRare Item"
)
.enchant(CompEnchantment.UNBREAKING, 3)
.modelData(5001)
.glow(true)
.unbreakable(true)
.tag("item_type", "wand")
.tag("spell_power", "100")
.make();
Colored leather armor
ItemStack redArmor = ItemCreator.of(CompMaterial.LEATHER_CHESTPLATE)
.name("&cFire Armor")
.color(CompColor.RED)
.enchant(CompEnchantment.PROTECTION, 4)
.enchant(CompEnchantment.FIRE_PROTECTION, 4)
.unbreakable(true)
.hideTags(true)
.make();
Reward item with glow
ItemStack reward = ItemCreator.of(CompMaterial.NETHER_STAR)
.name("&6&lDaily Reward")
.lore(
"",
"&7Right-click to claim:",
"&7• 1000 coins",
"&7• 10 experience",
"&7• Random item"
)
.glow(true)
.tag("reward_id", "daily_001")
.tag("expires", String.valueOf(System.currentTimeMillis() + 86400000))
.make();
Static configuration
setLorePrefix(String prefix)
Set the default prefix added to all lore lines. Default is “&7”.ItemCreator.setLorePrefix("&f"); // White lore instead of gray
Get the current lore prefix.