Class KnowledgeBookBuilder
java.lang.Object
io.github.lucfr1746.llibrary.itemstack.ItemBuilder
io.github.lucfr1746.llibrary.itemstack.KnowledgeBookBuilder
The
KnowledgeBookBuilder
class extends ItemBuilder
to provide
additional functionality for modifying KnowledgeBookMeta
of an ItemStack
.
This class allows adding, setting, and retrieving recipes for the knowledge book.-
Constructor Summary
ConstructorsConstructorDescriptionKnowledgeBookBuilder
(int amount) Constructs aKnowledgeBookBuilder
with the specified amount.KnowledgeBookBuilder
(@NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aKnowledgeBookBuilder
using an existingItemStack
. -
Method Summary
Modifier and TypeMethodDescriptionaddRecipes
(@NotNull org.bukkit.NamespacedKey... recipes) Adds recipes to the knowledge book.List
<org.bukkit.NamespacedKey> Gets all recipes in the knowledge book.boolean
Checks if the knowledge book contains any recipes.setRecipes
(@NotNull List<org.bukkit.NamespacedKey> recipes) Sets the recipes for the knowledge book, replacing any existing ones.Methods inherited from class io.github.lucfr1746.llibrary.itemstack.ItemBuilder
addAttributeModifier, addEnchant, addEnchant, addEnchant, addItemFlags, addLore, build, getAmount, getAttributeModifiers, getAttributeModifiers, getAttributeModifiers, getCustomModelData, getDamageResistant, getDisplayName, getEnchantable, getEnchantLevel, getEnchantmentGlintOverride, getEnchants, getEquippableComponent, getFoodComponent, getItemFlags, getItemMeta, getItemModel, getJukeboxPlayableComponent, getMaxStackSize, getRarity, getToolComponent, getTooltipStyle, getTranslationKey, getType, getUseCooldownComponent, getUseRemainder, hasAttributeModifiers, hasConflictingEnchant, hasCustomModelData, hasDamageResistant, hasEnchant, hasEnchantable, hasEnchantmentGlintOverride, hasEnchants, hasEquippableComponent, hasFoodComponent, hasItemFlag, hasItemModel, hasJukeboxPlayableComponent, hasMaxStackSize, hasRarity, hasToolComponent, hasTooltipStyle, hasUseCooldownComponent, hasUseRemainder, hideAllItemFlags, insertLore, isGlider, isHideTooltip, isUnbreakable, removeAttributeModifier, removeAttributeModifier, removeAttributeModifier, removeEnchant, removeEnchants, removeItemFlags, replaceLore, setAmount, setAttributeModifiers, setCustomModelData, setDamageResistant, setDisplayName, setEnchantable, setEnchantmentGlintOverride, setEquippableComponent, setEquippableComponent, setFood, setFoodComponent, setGlider, setHideTooltip, setItemModel, setItemModel, setJukeboxPlayableComponent, setJukeboxPlayableComponent, setJukeboxPlayableComponent, setLores, setLores, setMaxStackSize, setRarity, setToolComponent, setToolComponent, setTooltipStyle, setTooltipStyle, setType, setUnbreakable, setUseCooldownComponent, setUseCooldownComponent, setUseCooldownComponent, setUseRemainder
-
Constructor Details
-
KnowledgeBookBuilder
public KnowledgeBookBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Constructs aKnowledgeBookBuilder
using an existingItemStack
.- Parameters:
itemStack
- the item stack to modify- Throws:
IllegalArgumentException
- if the item's meta is not an instance ofKnowledgeBookMeta
-
KnowledgeBookBuilder
public KnowledgeBookBuilder(int amount) Constructs aKnowledgeBookBuilder
with the specified amount.- Parameters:
amount
- the quantity of items in the stack
-
-
Method Details
-
addRecipes
Adds recipes to the knowledge book.- Parameters:
recipes
- the recipes to add- Returns:
- this
KnowledgeBookBuilder
instance for method chaining
-
setRecipes
Sets the recipes for the knowledge book, replacing any existing ones.- Parameters:
recipes
- the list of recipes to set- Returns:
- this
KnowledgeBookBuilder
instance for method chaining
-
getRecipes
Gets all recipes in the knowledge book.- Returns:
- the list of recipes in the book
-
hasRecipes
public boolean hasRecipes()Checks if the knowledge book contains any recipes.- Returns:
- true if there are recipes, false otherwise
-