ModsJava
UtilityAPI
Java mod listed for Minecraft 1.16–1.18. Downloads from the MC Java Mods app on Android.
⬇ Download on SpigotUtilityAPI is in a very early stage of development and many features are still to come. If you wand a specific feature let me know and I'll see if I can implement it
Current Features:
Crafting
Cooldowns
Item and ItemBuilder
Inventory
Usage
To use UtilityAPI you have to do 3 things:
Now you can access the UtilityAPI's methods!
If you want to create crafting recipes or smithing recipes follow the code examples given in the Crafting category.
If you want to use the inventory methods follow the examples given in the Inventory category.
There is no documentation yet but I'm working on it.
This is my first API so if you have any tips or hints on how to make it better feel free to post them
If you need any help you can join myDiscord:
https://discord.gg/AkAdFf8NjB
Current Features:
Crafting
- Add crafting recipes faster and get more control over them
Spoiler: Code
Code (Text):
// The Material[] has to have 9 entries. They translate to the 9 slots in a crafting table (left to right)
// There is an overload for this method which takes in all 9 Material items instead of an array
// Material.AIR means the slot in the crafting table will have to be empty
Material[] ingredients = {Material.AIR, Material.COAL, Material.AIR,
Material.COAL, Material.COAL_BLOCK, Material.COAL,
Material.AIR, Material.COAL, Material.AIR};
CraftRecipe recipe = new CraftRecipe(new ItemStack(Material.DIAMOND), ingredients, "DiamondRecipe", this);
recipe.addRecipe();
// There is an overload for this method which takes in all 9 Material items instead of an array
// Material.AIR means the slot in the crafting table will have to be empty
Material[] ingredients = {Material.AIR, Material.COAL, Material.AIR,
Material.COAL, Material.COAL_BLOCK, Material.COAL,
Material.AIR, Material.COAL, Material.AIR};
CraftRecipe recipe = new CraftRecipe(new ItemStack(Material.DIAMOND), ingredients, "DiamondRecipe", this);
recipe.addRecipe();
- Add smithing recipes easier and with more control
Spoiler: Code
Code (Text):
SmithRecipe recipe = new SmithRecipe(new ItemStack(Material.NETHERITE_PICKAXE), Material.IRON_PICKAXE, Material.DIAMOND, "DiamondPick", this);
recipe.setResult(new ItemStack(Material.DIAMOND_PICKAXE));
recipe.addRecipe();
recipe.setResult(new ItemStack(Material.DIAMOND_PICKAXE));
recipe.addRecipe();
Cooldowns
- Easy to use cooldowns
Spoiler: Code
Code (Text):
// First create a cooldown
// Give it a time and TimeScale (Minutes or Seconds)
Cooldown cooldown = new Cooldown(10, TimeScale.SECONDS);
// Add a player to a cooldown
cooldown.addPlayerToCooldown(player);
// Remove a player from a cooldown
cooldown.removePlayerFromCooldown(player);
// Check if player is on cooldown
// Returns true/ false
cooldown.isOnCooldown(player);
// Get remaining time
// Returns an integer
cooldown.getRemainingCooldown(player); // This will always return in the unit that was given when the cooldown was created
cooldown.getRemainingCooldown(player, TimeScale.MINUTES); // This will return in the given unit
// Give it a time and TimeScale (Minutes or Seconds)
Cooldown cooldown = new Cooldown(10, TimeScale.SECONDS);
// Add a player to a cooldown
cooldown.addPlayerToCooldown(player);
// Remove a player from a cooldown
cooldown.removePlayerFromCooldown(player);
// Check if player is on cooldown
// Returns true/ false
cooldown.isOnCooldown(player);
// Get remaining time
// Returns an integer
cooldown.getRemainingCooldown(player); // This will always return in the unit that was given when the cooldown was created
cooldown.getRemainingCooldown(player, TimeScale.MINUTES); // This will return in the given unit
Item and ItemBuilder
- Item works like ItemStacks but applies the ItemMeta for you.
Spoiler: Code
Code (Text):
Item item = new Item(Material.GOLDEN_SWORD);
item.addEnchant(Enchantment.FIRE_ASPECT, 1, true);
item.setName(ChatColor.RED + "Fire Sword");
item.addFlags(ItemFlag.HIDE_ENCHANTS);
item.setUnbreakable(true);
player.getInventory().addItem(item.getItemStack());
item.addEnchant(Enchantment.FIRE_ASPECT, 1, true);
item.setName(ChatColor.RED + "Fire Sword");
item.addFlags(ItemFlag.HIDE_ENCHANTS);
item.setUnbreakable(true);
player.getInventory().addItem(item.getItemStack());
- ItemBuilder allows you to create ItemStacks in just one line of code. It's perfect for just small Items you need to quickly create or test around with.
Spoiler: Code
Code (Text):
ItemStack stack = new ItemBuilder(Material.DIAMOND_SWORD).setDisplayName(ChatColor.BLUE + "Ice Sword").addEnchant(Enchantment.KNOCKBACK, 3).addFlags(ItemFlag.HIDE_ENCHANTS).addToLore(ChatColor.WHITE + "Freezes Players").getItemStack();
Inventory
- Remove a certain amount of items from an inventory or player.
Spoiler: Code
Code (Text):
utilityAPI.inventory.removeItem(player, Material.STICK, 10);
- Check if a player inventory contains certain items.
Spoiler: Code
Code (Text):
if(utilityAPI.inventory.containsItems(player, Material.STICK, 10)) {
player.sendMessage(ChatColor.GREEN + "You own at least 10 sticks!");
}
player.sendMessage(ChatColor.GREEN + "You own at least 10 sticks!");
}
Usage
To use UtilityAPI you have to do 3 things:
- Include the UtilityAPI.jar in your project and put it in your plugins folder
- Add a depend to your plugin.yml:
Code (Text):depend: [UtilityAPI]
- Put this line of code in your main class:
Code (Text):public static UtilityAPI utilityAPI = (UtilityAPI) Bukkit.getServer().getPluginManager().getPlugin("UtilityAPI");
Now you can access the UtilityAPI's methods!
If you want to create crafting recipes or smithing recipes follow the code examples given in the Crafting category.
If you want to use the inventory methods follow the examples given in the Inventory category.
There is no documentation yet but I'm working on it.
This is my first API so if you have any tips or hints on how to make it better feel free to post them
If you need any help you can join myDiscord:
https://discord.gg/AkAdFf8NjB
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.16, 1.17, 1.18
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
UtilityAPI is a free Minecraft Java mod. Compatible with Minecraft 1.16, 1.17, 1.18. Downloaded 281 times (via Spigot). Download it and open it directly in the game.