Home›Java›Mods›UtilityAPI
UtilityAPI
ModsJava

UtilityAPI

Java mod listed for Minecraft 1.16–1.18. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
UtilityAPI 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
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();

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();


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


Item and ItemBuilder
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());

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
Spoiler: Code
Code (Text):
utilityAPI.inventory.removeItem(player, Material.STICK, 10);
Spoiler: Code
Code (Text):
if(utilityAPI.inventory.containsItems(player, Material.STICK, 10)) {
    player.sendMessage(ChatColor.GREEN + "You own at least 10 sticks!");
}


Usage

To use UtilityAPI you have to do 3 things:

  1. Include the UtilityAPI.jar in your project and put it in your plugins folder
  2. Add a depend to your plugin.yml:
    Code (Text):
    depend: [UtilityAPI]
  3. 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

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

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.

Explore more