API
ItemsAdder includes an easy to use API for Java/Skript developers. To access it just include dev.lone.itemsadder.api.ItemsAdder in your code.
1
//Checks if an item is a custom item made with ItemsAdder
2
public static boolean isCustomItem(ItemStack itemStack)
3
public static boolean isCustomItem(String customItemName)
4
5
//Get an ItemsAdder custom item by its name in config
6
public static ItemStack getCustomItem(String nameInConfig)
7
8
//Spawns a block made with ItemsAdder specifying the itemstack
9
//(obtain it with getCustomItem)
10
public static void placeCustomBlock(Location location, ItemStack customBlock)
11
public static void placeCustomBlock(Location location, ItemStack customBlock, boolean lightweight)
12
13
//Check if a block in the world is a custom block made with ItemsAdder
14
public static boolean isCustomBlock(Block block)
15
16
//plants custom seed like a normal player would do
17
public static void placeCustomCrop(Location location, ItemStack seed)
18
19
//check if block is custom planted crop with custom seed
20
public static boolean isCustomCrop(Block block)
21
22
//get custom seed of custom crop
23
public static String getCustomSeedNameFromCrop(Block block)
24
25
//returns the ItemStack of a custom block in world
26
public static ItemStack getCustomBlock(Block block)
27
28
//check if an entity in world is a furniture
29
public static boolean isFurniture(Entity entity)
30
31
//check if an ItemStack is a specific custom item
32
//(example: check if a pickaxe is 'amethyst_pickaxe')
33
public static boolean matchCustomItemName(ItemStack itemStack, String customItemName)
34
35
//get name of the item in config (ex: 'ruby_pickaxe')
36
public static String getCustomItemName(ItemStack itemStack)
37
38
//get name of config where the item is declared (ex: 'items/swords')
39
public static String getCustomItemFileName(ItemStack itemStack)
40
41
//gets usages remaining of this item (-999 if it has no usages specified = infinite)
42
public static int getCustomItemUsages(ItemStack itemStack)
43
44
//set custom item durability (also works with vanilla items and with
45
//custom items with default vanilla durability)
46
public static ItemStack setCustomItemDurability(ItemStack item, int durability)
47
48
//get custom durability
49
public static int getCustomItemDurability(ItemStack itemStack)
50
51
//get max custom durability
52
public static int getCustomItemMaxDurability(ItemStack itemStack)
53
Copied!
Last modified 2yr ago
Copy link