ScotTools

Description

This mod enables all tools, such as picks, to mine with the correct speed depending on the material of the block. For example, IndustrialCraft adds new ores that take forever to mine, and mine at the same speed using a wooden pickaxe, and a diamond pickaxe. This mod fixes that, so you can easily fly through any stone-type block when using a pick, like you're supposed to. This mod is compatible with every MoreOres mod, or any mod that adds new blocks to the game.

For Modders

Please note that using the source code for MCP is not necessary, as I've found that decompiling a minecraft.jar with ModLoader and ScotTools already installed works perfectly fine, and will remove the class files from showing up in the reobf folder, making it easier to release mods. If you do use the source code in the src folder, you will see the class files in the reobf folder. I ask that you please do not release ScotTools, but rather link to this thread for users to download. Thank you.

Examples:

public class mod_BetterWood extends BaseMod

{

public static ToolMaterial magicTools;

public mod_BetterWood

{

magicAxe = (new ItemCustomAxe(magicAxeID, 100, 5.0F, 1)).setItemName("magicAxe");

magicHoe = (new ItemCustomHoe(magicHoeID, 100)).setItemName("magicHoe");

magicPickaxe = (new ItemCustomPickaxe(magicPickaxeID, 1, 100, 5.0F, 0)).setItemName("magicPickaxe");

magicShovel = (new ItemCustomSpade(magicShovelID, 100, 5.0F, 0)).setItemName("magicShovel");

magicSword = (new ItemCustomSword(magicSwordID, 100, 6)).setItemName("magicSword");

magicMachete = (new ItemCustomMaterialTool(magicMacheteID, 1, 0, 100, 6.5F, 0, false, new Material[] { Material.leaves })).setItemName("magicMachete");

magicCustomPick = (new ItemCustomMaterialTool(magicCustomPickID, 1, 2, 100, 6.5F, 0, true, new Material[] { Material.wood, Material.ground })).setItemName("magicCustomPick");

magicUselessTool = (new ItemCustomMaterialTool(magicUselessToolID, 1, 0, 100, 6.5F, 0, false, new Material[] { })).setItemName("magicUselessTool");

magicSandShovel = (new ItemCustomBlockTool(magicSandShovelID, 2, 0, 100, 6.5F, 0, false, new Block[] { Block.sand })).setItemName("magicSandShovel");

magicTools = (new ToolMaterial(1, 208, 6.5F, 1));

magicAxe = (new ItemCustomAxe(magicAxeID, 3, magicTools)).setItemName("magicAxe");

magicHoe = (new ItemCustomHoe(magicHoeID, magicTools)).setItemName("magicHoe");

magicPickaxe = (new ItemCustomPickaxe(magicPickaxeID, 2, magicTools)).setItemName("magicPickaxe");

magicShovel = (new ItemCustomSpade(magicShovelID, 1, magicTools)).setItemName("magicShovel");

magicSword = (new ItemCustomSword(magicSwordID, magicTools)).setItemName("magicSword");

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

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

}

/*

==AXES==

You must replace ItemAxe with ItemCustomAxe

magicAxeID is the item ID (using MLProps, took out the code used for the config file to simplify the example)

100 is the durabitility of the axe

5.0F is the speed of which the tool mines

1 is the increase in the amount of damage dealt by the tool

==HOES==

You must replace ItemHoe with ItemCustomHoe

magicHoeID is the itemID

100 is the durability of the hoe

==PICKAXES==

You must replace ItemPickaxe with ItemCustomPickaxe

magicPickaxeID is the item ID

1 is the harvesting level (see bottom for harvesting level details)

100 is the durability of the pick

5.0F is the mining speed

0 is the increase in the amount of damage dealt by the tool

==SHOVELS==

You must replace ItemSpade with ItemCustomSpade

magicShovelID is the item ID

100 is the durability

5.0F is the mining speed

0 is the increase in damage dealt

==SWORDS==

You must replace ItemSword with ItemCustomSword

magicSwordID is the item ID

100 is the durability

6 is the damage dealt (this number is multiplied by 2, then added to 4. These numbers are in half-hearts: 2 damage equals 1 heat of damage)

==USING TOOLMATERIAL.CLASS==

Alternatively to declaring tools/weapons each separately, you can now create a Tool Material, which is similar to the information declared in the EnumToolMaterial class.

public static ToolMaterial magicTools (this initializes the variable to be used)

magicTools = (new ToolMaterial(1, 208, 6.5F, 1); (this declares the variable)

1 is the tool's harvest level

208 is the durability

6.5F is the speed of the tool

1 is the damageVsEntity when using a sword only

TOOLS

For Axes, Pickaxes, and Spades, you use this format:

(Item ID, tool type, toolmaterial) Where tool type is either 1: Shovels, 2: Pickaxes, or 3: Axes.

WEAPONS AND HOES

For Hoes and Swords, use this format:

(Item ID, toolmaterial) Where tool material declares the max uses for the hoe, and for the sword, it declares the max uses and the damage vs entity. Look at ToolMaterial if you are still unsure about something.

==CUSTOM TOOLS vs. MATERIALS==

MAGIC MACHETE

You must replace ItemTool with ItemCustomMaterialTool

magicMacheteID is the item ID

1 is the initial damage vs. entity based on tool type (axes are 3, pickaxes are 2, and shovels are 1, everything else is 0)

0 is the harvesting level

100 is the durability

6.5F is the block breaking speed

0 is the increase in damage vs. entity (normally only for swords)

false means that it is not a pick

new Material[] { Material.leaves } specifies the materials the tool can break

MAGIC CUSTOM PICK

You must replace ItemTool with ItemCustomMaterialTool

magicCustomPickID is the item ID

1 is the initial damage vs. entity based on tool type (axes are 3, pickaxes are 2, and shovels are 1, everything else is 0)

2 is the harvesting level

100 is the durability

6.5F is the block breaking speed

0 is the increase in damage vs. entity (normally only for swords)

true means that it is a pick, and can mine rock and iron and any other block that is minable with the tool's harvesting level

new Material[] { Material.wood, Material.ground } specifies the materials the pick can break. Notice that Material.stone, etc. was not listed here. toolIsPick variable (the true or false) will determine whether the tool can break these materials.

MAGIC USELESS TOOL (Just explaining that defining a new custom tool that is not efficient on any specific materials must still declare an empty Material[])

You must replace ItemTool with ItemCustomMaterialTool

magicUselessToolID is the item ID

1 is the initial damage vs. entity based on tool type (axes are 3, pickaxes are 2, and shovels are 1, everything else is 0)

0 is the harvesting level

100 is the durability

6.5F is the block breaking speed

0 is the increase in damage vs. entity (normally only for swords)

false means that it is not a pick

new Material[] { } specifies the materials the pick can break

==CUSTOM TOOLS vs. BLOCKS==

MAGICSANDSHOVEL

You must replace ItemTool with ItemCustomBlockTool

magicSandShovelID is the item ID

2 is the initial damage vs. entity based on tool type

0 is the harvesting level

100 is the durability

6.5F is the block breaking speed

0 is the increase in damage vs. entity (normally only for swords)

false means that it is not a pick

new Block[] { Block.sand } specifies the only blocks the shovel will be effective against

==HARVESTING LEVELS==

obisidian requires 3

diamond, gold, redstone requires 2+

iron, lapis lazuli requires 1+

everything else stone or iron requires a normal pick

==ADDING BLOCKS WITH HARVESTING LEVELS==

ScotTools.AddBlocks(Block block[], int i);

block[] are the blocks you would like to add to a specified level

int i is the class of tools you would like the block(s) to require to harvest the ore/block

you may declare multiple blocks in one "AddBlocks" method.

Example:

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

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

Note that the harvesting level (int i) for this method cannot exceed 6 (since v6.0), but upon request, I can increase this limit further.

*/

ScotTools adds the capability to allow new tools to be created, using custom durability, speed, etc., without editing the bn.class (aka, EnumToolMaterial). What this means, is that mods that don't use this mod that add new tools will still work that mods that do use this mod. These new tools will also work with other mods' new blocks as well! Check the source code and examples for help if you're having trouble.

Also, if your mod adds a new tool into the game that MUST use a custom class file (e.g. ItemSilverPickaxe), you may use my source code with your tools, to make them have the same functionality as my mod. You only need to do this for tools that have special abilites, not for basic tools with special mining speeds or durability, etc. If you have any questions, comments or concerns just PM me.

Furthermore, you may use "ItemCustomMaterialTool" to create a custom tool (e.g. a machete) that will be efficient on specified materials (i.e. Material.leaves).

Next, you can also require blocks to be mined with a certain tool class, instead of every pickaxe. For example, you may add a new ore in your mod, but you only want people to mine it with diamond pickaxes, now you can do this. The harvesting level for blocks can be set up to 6 (diamond picks are 3), so you may add new ores that can only be mined with your tools.

You can also use ScotTools to declare tool classes, similar to the way the EnumToolMaterial class works, but without requiring the editing of the class. Just simply create a new ToolMaterial variable using the constructor as a guide, or view the examples in the spoiler above. This is just to simplify the creation of custom tools so that you do not need to declare durability or speed multiple times.

Version History

v10.1 SSP & SMP - Small bug update for the grass material vs. shovels.

v10.0 SSP - Removed AddBlocksBurning and AddBlocksNetherrack since they aren't very useful or important, and caused some issues when yh.class was overwritten by another mod. Updated for Beta 1.7.2. SMP is not updated yet!

v9.1 SSP - Fixed AddBurning method so it doesn't disable the burning of old minecraft blocks, such as leaves or planks (all of them actually).

v9.0 SMP - Update to match SSP v9.0

v8.1 SMP - Fixed some rather important bugs, such as tool durability not working.

v9.0 SSP - Added the ToolMaterial class. This will allow for the creation of tool classes so that you do not have to declare the durabilities and speeds of each individual tool.

v8.0 SMP - Initial release for Beta 1.6.6, thanks to MasterDeity.

v8.0 - Added the AddBlocksBurning and AddBlocksNetherrack methods. Just declare the AddBlocksBurning like you would in the BlockFire class using the setBlockBurning(Block block, int i, int j) method. You can also use arrays for these two methods to shorten the code. AddBlocksNetherrack only has one varible, the block.