Class ItemsAdder
java.lang.Object
dev.lone.itemsadder.api.ItemsAdder
API entry point for ItemsAdder.
Most methods in this class are deprecated in favor of the dedicated wrapper classes such as
CustomStack, CustomBlock, CustomFurniture, and CustomEntity.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyResourcepack(Player player) Sends the configured resource pack to a player.static booleanDeprecated.use load events and dedicated registry methods instead.static List<CustomStack> Returns all the registered items.static List<CustomStack> getAllItems(String namespace) Returns all the registered items by a specific namespace.static List<CustomStack> getAllItems(Material material) Returns all the registered items which use a specific Bukkit Material.static @Nullable ItemStackgetCustomBlock(Block block) Deprecated.useCustomBlock.byAlreadyPlaced(Block)instead.static BlockDatagetCustomBlockBlockData(ItemStack customBlock, boolean lightweight) Deprecated.useCustomBlock.getBaseBlockData()instead.static ItemStackgetCustomBlockByFaces(Material material, HashMap<BlockFace, Boolean> blockFaces) Deprecated.use dedicated custom block APIs instead.getCustomBlockLoot(Block block) Deprecated.useCustomBlock.getLoot(Block, ItemStack, boolean)instead.getCustomBlockLoot(Block block, boolean includeSelfBlock) Deprecated.useCustomBlock.getLoot(Block, ItemStack, boolean)instead.getCustomBlockLoot(Block block, ItemStack tool, boolean includeSelfBlock) Deprecated.useCustomBlock.getLoot(Block, ItemStack, boolean)instead.static ItemStackgetCustomItem(String namespacedId) Deprecated.useCustomStack.getInstance(String)instead.static intgetCustomItemDurability(ItemStack itemStack) Deprecated.useCustomStack.getDurability()instead.static intgetCustomItemMaxDurability(ItemStack itemStack) Deprecated.useCustomStack.getMaxDurability()instead.static StringgetCustomItemName(ItemStack itemStack) Deprecated.useCustomStack.byItemStack(ItemStack)andCustomStack.getNamespacedID()instead.static intgetCustomItemUsages(ItemStack itemStack) Deprecated.useCustomStack.byItemStack(ItemStack)andCustomStack.getUsages()instead.static StringgetCustomSeedNameFromCrop(Block block) Deprecated.useCustomCrop.byAlreadyPlaced(Block)andCustomCrop.getSeed()instead.static @Nullable StringgetLiquidName(Location location) Deprecated.custom liquid APIs are deprecated.Deprecated.useCustomBlock.getNamespacedIdsInRegistry()instead.getNamespacedBlocksNamesInConfig(String searchStr) Deprecated.useCustomBlock.getNamespacedIdsInRegistry()instead.static @Nullable StringgetPackUrl(boolean appendHash) Gets the configured resource pack URL.static booleanhasKeepOnDeath(String namespacedId) Checks if a registered item has the keep-on-death behaviour.static booleanhasKeepOnDeath(ItemStack itemStack) Checks if an item stack has the keep-on-death behaviour.static booleanisCustomBlock(Block block) Deprecated.useCustomBlock.byAlreadyPlaced(Block)instead.static booleanisCustomCrop(Block block) Deprecated.useCustomCrop.byAlreadyPlaced(Block)instead.static booleanisCustomItem(String customItemName) Deprecated.useCustomStack.isInRegistry(String)instead.static booleanisCustomItem(ItemStack itemStack) Deprecated.useCustomStack.byItemStack(ItemStack)instead.static booleanisCustomRecipe(String namespacedId) Checks if a recipe is registered by ItemsAdder.static booleanisCustomRecipe(NamespacedKey namespacedKey) Checks if a recipe is registered by ItemsAdder.static booleanisFurniture(Entity entity) Deprecated.useCustomFurniture.byAlreadySpawned(Entity)instead.static booleanmatchCustomItemName(ItemStack itemStack, String customItemName) Deprecated.static voidplaceCustomBlock(Location location, ItemStack itemStack) Deprecated.useCustomBlock.place(String, Location)instead.static voidplaceCustomCrop(Location location, ItemStack seed) Deprecated.useCustomCrop.place(String, Location)instead.static booleanplayTotemAnimation(Player player, String namespacedId) Play totem animation.static voidremoveCustomBlock(Location location) Deprecated.useCustomBlock.remove(Location)instead.static ItemStacksetCustomItemDurability(ItemStack item, int durability) Deprecated.useCustomStack.setDurability(int)instead.static ItemStacksetCustomItemMaxDurability(ItemStack item, int maxDurability) Deprecated.useCustomStack.setMaxDurability(int)instead.static voidDeprecated.custom liquid APIs are deprecated.
-
Constructor Details
-
ItemsAdder
public ItemsAdder()
-
-
Method Details
-
areItemsLoaded
Deprecated.use load events and dedicated registry methods instead.Checks if ItemsAdder items are loaded.- Returns:
- true if items are loaded.
-
isCustomItem
Deprecated.useCustomStack.byItemStack(ItemStack)instead.Checks if an item stack is an ItemsAdder custom item.- Parameters:
itemStack- the item stack to check.- Returns:
- true if the item is custom.
-
isCustomItem
Deprecated.useCustomStack.isInRegistry(String)instead.Checks if a custom item is registered.- Parameters:
customItemName- the custom item namespaced id.- Returns:
- true if the item is registered.
-
getCustomItem
Deprecated.useCustomStack.getInstance(String)instead.Gets a custom item stack copy.- Parameters:
namespacedId- the custom item namespaced id.- Returns:
- the custom item stack.
-
placeCustomBlock
Deprecated.useCustomBlock.place(String, Location)instead.Places a custom block from an item stack.- Parameters:
location- the target location.itemStack- the custom block item stack.
-
removeCustomBlock
Deprecated.useCustomBlock.remove(Location)instead.Removes a custom block at a location.- Parameters:
location- the custom block location.
-
getCustomBlockByFaces
@Deprecated public static ItemStack getCustomBlockByFaces(Material material, HashMap<BlockFace, Boolean> blockFaces) Deprecated.use dedicated custom block APIs instead.Gets a custom block item by its base material and facing data.- Parameters:
material- the base material.blockFaces- the facing data.- Returns:
- the custom block item stack.
-
isCustomBlock
Deprecated.useCustomBlock.byAlreadyPlaced(Block)instead.Checks if a block is an ItemsAdder custom block.- Parameters:
block- the block to check.- Returns:
- true if the block is custom.
-
getCustomBlockLoot
Deprecated.useCustomBlock.getLoot(Block, ItemStack, boolean)instead.Gets loot generated by a custom block.- Parameters:
block- the custom block.includeSelfBlock- true to include the custom block item itself.- Returns:
- the generated loot.
-
getCustomBlockLoot
Deprecated.useCustomBlock.getLoot(Block, ItemStack, boolean)instead.Gets loot generated by a custom block.- Parameters:
block- the custom block.- Returns:
- the generated loot.
-
getCustomBlockLoot
@Deprecated public static List<ItemStack> getCustomBlockLoot(Block block, ItemStack tool, boolean includeSelfBlock) Deprecated.useCustomBlock.getLoot(Block, ItemStack, boolean)instead.Gets loot generated by a custom block.- Parameters:
block- the custom block.tool- the tool used to break the block.includeSelfBlock- true to include the custom block item itself.- Returns:
- the generated loot.
-
placeCustomCrop
Deprecated.useCustomCrop.place(String, Location)instead.Places a custom crop from a seed item stack.- Parameters:
location- the target location.seed- the seed item stack.
-
isCustomCrop
Deprecated.useCustomCrop.byAlreadyPlaced(Block)instead.Checks if a block is an ItemsAdder custom crop.- Parameters:
block- the block to check.- Returns:
- true if the block is a custom crop.
-
getCustomSeedNameFromCrop
Deprecated.useCustomCrop.byAlreadyPlaced(Block)andCustomCrop.getSeed()instead.Gets the seed namespaced id associated with a custom crop block.- Parameters:
block- the crop block.- Returns:
- the seed namespaced id.
-
getCustomBlock
Deprecated.useCustomBlock.byAlreadyPlaced(Block)instead.Gets the custom block item for an already placed block.- Parameters:
block- the block to check.- Returns:
- the custom block item stack, null if the custom block was removed from config, or a vanilla item for non-custom blocks.
-
matchCustomItemName
Deprecated.Checks if an item stack matches a custom item namespaced id.- Parameters:
itemStack- the item stack to check.customItemName- the custom item namespaced id.- Returns:
- true if the item matches.
-
isFurniture
Deprecated.useCustomFurniture.byAlreadySpawned(Entity)instead.Checks if an entity is simple furniture.- Parameters:
entity- the entity to check.- Returns:
- true if the entity is furniture.
-
getCustomItemName
Deprecated.useCustomStack.byItemStack(ItemStack)andCustomStack.getNamespacedID()instead.Gets the custom item namespaced id stored on an item stack.- Parameters:
itemStack- the item stack.- Returns:
- the custom item namespaced id.
-
getCustomItemUsages
Deprecated.useCustomStack.byItemStack(ItemStack)andCustomStack.getUsages()instead.Gets the usages stored on a custom item stack.- Parameters:
itemStack- the item stack.- Returns:
- the usages value, or 0 if not present.
-
setCustomItemDurability
Deprecated.useCustomStack.setDurability(int)instead.Sets custom durability on an item stack.- Parameters:
item- the item stack.durability- the new durability.- Returns:
- the same item stack.
-
setCustomItemMaxDurability
Deprecated.useCustomStack.setMaxDurability(int)instead.Sets maximum custom durability on an item stack.- Parameters:
item- the item stack.maxDurability- the new maximum durability.- Returns:
- the same item stack.
-
getCustomItemDurability
Deprecated.useCustomStack.getDurability()instead.Gets custom durability from an item stack.- Parameters:
itemStack- the item stack.- Returns:
- the durability value.
-
getCustomItemMaxDurability
Deprecated.useCustomStack.getMaxDurability()instead.Gets maximum custom durability from an item stack.- Parameters:
itemStack- the item stack.- Returns:
- the maximum durability value.
-
getNamespacedBlocksNamesInConfig
Deprecated.useCustomBlock.getNamespacedIdsInRegistry()instead.Searches registered custom block namespaced ids.- Parameters:
searchStr- the search string, or null.- Returns:
- matching custom block namespaced ids.
-
getNamespacedBlocksNamesInConfig
Deprecated.useCustomBlock.getNamespacedIdsInRegistry()instead.Gets all registered custom block namespaced ids.- Returns:
- custom block namespaced ids.
-
getCustomBlockBlockData
@Deprecated public static BlockData getCustomBlockBlockData(ItemStack customBlock, boolean lightweight) Deprecated.useCustomBlock.getBaseBlockData()instead.Gets the block data used by a custom block item stack.- Parameters:
customBlock- the custom block item stack.lightweight- currently unused.- Returns:
- the block data, or null if not supported.
-
playTotemAnimation
Play totem animation. Warning: make sure to delay it using a bukkit runnable (1 tick should be ok) if you call this after you close an inventory or sometimes animation won't show.Returns true if successful, returns false if the totem namespacedid is not valid.
- Parameters:
player- the player that will see the animation.namespacedId- the custom totem namespaced id.- Returns:
- true if the animation was sent.
-
setLiquid
Deprecated.custom liquid APIs are deprecated.Places a custom liquid at a location.- Parameters:
namespacedID- the liquid namespaced id.location- the target location.
-
getLiquidName
Deprecated.custom liquid APIs are deprecated.Gets the custom liquid namespaced id at a location.- Parameters:
location- the location to check.- Returns:
- the liquid namespaced id, or null if no custom liquid is stored there.
-
hasKeepOnDeath
Checks if an item stack has the keep-on-death behaviour.- Parameters:
itemStack- the item stack to check.- Returns:
- true if the item has keep-on-death behaviour.
-
hasKeepOnDeath
Checks if a registered item has the keep-on-death behaviour.- Parameters:
namespacedId- the custom item namespaced id.- Returns:
- true if the item has keep-on-death behaviour.
-
applyResourcepack
Sends the configured resource pack to a player.- Parameters:
player- the player.
-
getAllItems
Returns all the registered items.- Returns:
- null if ItemsAdder is not loaded completely, be sure to listen to ItemsAdderFirstLoadEvent
-
getAllItems
Returns all the registered items by a specific namespace.- Returns:
- null if ItemsAdder is not loaded completely, be sure to listen to ItemsAdderFirstLoadEvent
-
getAllItems
Returns all the registered items which use a specific Bukkit Material.- Returns:
- null if ItemsAdder is not loaded completely, be sure to listen to ItemsAdderFirstLoadEvent
-
isCustomRecipe
Checks if a recipe is registered by ItemsAdder.- Parameters:
namespacedKey- the recipe key.- Returns:
- true if the recipe is a custom ItemsAdder recipe.
-
isCustomRecipe
Checks if a recipe is registered by ItemsAdder.- Parameters:
namespacedId- the recipe namespaced id.- Returns:
- true if the recipe is a custom ItemsAdder recipe.
-
getPackUrl
Gets the configured resource pack URL.- Parameters:
appendHash- currently unused.- Returns:
- the pack URL, or null if it is not available.
-