uMods uMods

Back to Mods

There's not much to say about this mod, though it's probably the one mod I always use, even if it isn't required by a mod I'm using. uTools, formerly ScotTools, changes the way tools work so they check a block's material to determine whether that tool is capable of quickly breaking that block. Even blocks that are added from mods that don't use uTools will still be fixed!

Video Demonstration


Code Examples


public class mod_BetterWood extends BaseMod
{
    public ToolMaterial magicTools;
    public Item magicAxe;
    public Item magicHoe;
    public Item magicPickaxe;
    public Item magicShovel;
    public Item magicSword;
    public Item magicMachete;
    public Item magicSandShovel;

    public void load()
    {
        magicTools = (new ToolMaterial(1, 208, 6.5F, 1, 10));
        magicAxe = (new ItemAxe(magicAxeID, magicTools)).setItemName("magicAxe");
        magicHoe = (new ItemHoe(magicHoeID, magicTools)).setItemName("magicHoe");
        magicPickaxe = (new ItemPickaxe(magicPickaxeID, magicTools)).setItemName("magicPickaxe");
        magicShovel = (new ItemSpade(magicShovelID, magicTools)).setItemName("magicShovel");
        magicSword = (new ItemSword(magicSwordID, magicTools)).setItemName("magicSword");

        magicMachete = (new ItemMachete(magicMacheteID, 4, magicTools)).setItemName("magicMachete");
        magicSandShovel = (new ItemMachete(magicSandShovelID, 1, magicTools)).setItemName("magicSandShovel");

        ScotTools.AddBlocks(new Block[] { elementBlock, Block.stone }, 2);
        ScotTools.AddBlocks(Block.cobblestone, 1);
    }

/*
==USING TOOLMATERIAL.CLASS==
Introduction of Using the ScotTools API
   "Imagine ToolMaterial variables as though they were tool classes found in EnumToolMaterial. 
    Next, look at each of the variables used to create these tool classes and compare them with the 
    variables found in ToolMaterial. 
    This idea may benefit you when coding with ScotTools, since you have the ability to compare your 
    variables with 'vanilla' Minecraft tools."

-public static ToolMaterial magicTools; //initializes the variable to be used//
-magicTools = (new ToolMaterial(1, 208, 6.5F, 1)); //states what class file to initialize and states the parameters of the class//
-1 //harvest level//
-208 //durability//
-6.5F //rate of efficient block-breaking//
-1 //damageVsEntity of a sword against entities//
-10 //enchantability ^1//

TOOLS
Use these parameters when declaring your item: First, an int variable (or a non-variable number) which will be the ID of the item. The final parameter is a ToolMaterial variable (e.g. (new ToolMaterial(
ItemTool(int id, ToolMaterial toolmaterial) //Reference ToolMaterial.java in the source if you are still uncertain about the class's usage//

==CUSTOM TOOLS vs. MATERIALS==
MAGIC MACHETE
-extends ItemTool //create a new item class to override the method getStrVsBlock ^2 ^3//
-magicMacheteID //item ID//
-0 //type of tool (Shovel: 1, Pick: 2, Axe: 3, Other: 0)//
-magicTools //ToolMaterial variable containing the tool stats//

==CUSTOM TOOLS vs. BLOCKS==
MAGICSANDSHOVEL
-extends ItemTool //^3//
-magicSandShovelID //item ID//
-1 //type of tool (Shovel: 1, Pick: 2, Axe: 3, Other: 0)//
-magicTools //ToolMaterial variable containing the tool stats//

==HARVESTING LEVELS==
obisidian requires 3
diamond, gold, redstone requires 2+
iron, lapis lazuli requires 1+
stone and iron requires any pickaxe

==ADDING BLOCKS WITH HARVESTING LEVELS==
ScotTools.AddBlocks(Block block[], int i);
-block[] //blocks you would like to add to a specified level//
-int i //harvesting level of the block(s) determining whether a block is harvested//
You may declare multiple blocks in one "ScotTools.AddBlocks" method
Example:
     ScotTools.AddBlocks(new Block[] { elementBlock, Block.stone }, 2);
     ScotTools.AddBlocks(Block.cobblestone, 1);
Note: The harvesting level (int i) for this method cannot exceed 6, but upon request, I can increase this limit further. Do NOT use 0 as the int parameter, since it will just cause an error.

*/Notes/*
^1 - Enchantments
    a) I haven't thoroughly tested the ToolMaterial enchantability variable, so I'm uncertain if it works properly. If it does, please send me a PM explaining the results. Thank you. 
    B) Check the EnumToolMaterial source file for an idea of what to put as the value. The original values are set by default to the following: Wood: 15, Stone: 5, Iron: 14, Diamond: 10, Gold: 22. 
^2 - Planned feature to choose either a) a Material that returns efficiency, B) an array of Block variables, or c) one Block variable. */
							
Version History

v13.2 SSP - Fixed pickaxe vs. stone break speed.
v13.1 SSP - Fixed shovel vs. clay break-speed. Updated source files as well.
v13.0 SSP - Lots of code changes and updates; Most should not affect the actual gameplay or other modder's code. Changed vanilla blocks to register with ScotTools when either a) another mod uses ScotTools.AddBlocks (occurs during mod initialization or B) a player uses a pickaxe on any block (only occurs once per a game session). Also, I have not tested the enchantment aspects with ScotTools, so any bugs pertaining to this should be reported. Added a debug feature that states the block name, ID, and the harvesting level in errortest.bat-type logs.
v12.0 SSP - Changed some aspects of ScotTools: ItemCustomTool/ToolType has been merged with the vanilla class file.