FANDOM


This Article is up to date with Custom Stuff 2 CS2

Here are several examples for each of the basic types of tools that can be created with Custom Stuff. Keep in mind that these are not the be-all, end-all of tools that can be created; just examples of the common types that players are most accustomed to from playing with vanilla Minecraft.

When making tools, there are a few things to keep in mind. First and foremost is how strong do you want it to be. Making note of the varying values for efficiency and maxDamage  for the vanilla tools is a good way to gauge how powerful your tool will become. You can also set things like damage, or give your tool special effects to make it more or less powerful.

You also have to be aware of the behaviors of vanilla tools if you want your creation to be as realistic as possible. For example, when pickaxes, shovels, and axes are used as weapons they take more damage than if they're used to break blocks. Swords are the reverse of this, taking more damage from blocks than from mobs.

In the examples below any line that needs explaination has a note on it beginning with "//".


CS2 script - v.0.9.10 and up.

All examples below require the same basic addition to the mod.js file in order to be loaded in the game. For example, if your custom sword's file is named "Sword.js" and it's ID variable is just called "Sword", the following line is added the the mod.js:
mod.js

config.addItemIdProperty("Sword", 10052);
mod.addItem("Sword.js", "normal");

All files for creating custom items go in the /items/ folder of your project as normal.

Pickaxe

A simple pickaxe that is capable of digging through obsidian, despite not being of diamond quality. It also breaks much more quickly when used as a weapon, representing a 'flaw' in its parent material.

name = "emeraldPickaxe";
id = config.getItemId("EPickaxe");
displayName = "Emerald Pickaxe";
textureFile = "EPickaxe.png";
full3d = true;

maxDamage = 1562;       //How many actions the tool can perform then break.
damage[0] = 5;          //The damage to an entity hit with item.
efficiency[0] = 7.5;    //The speed that the pickaxe digs
harvestLevel = 2;       //Blocks that can be harvested are same as iron
toolClass = "pickaxe";  //Sets the type of this particular tool to "pickaxe"
harvestBlocks = "49";   //Can harvest Obsidian. 49=ID of obsidian
efficienyBlocks = "49"; //Efficiency when mining obsidian.
repairable = true;      //The tool can be repaired.

onBlockDestroyed[0] = "itemstack.damageItem(1);";
                      //This blockdestroyed trigger shown here damages the
                      //pickaxe when it breaks a block.
onHitEntity[0] = "itemstack.damageItem(4);";
                      //This trigger damages the pickaxe when it's used to
                      //deal damage to a mob.

Shovel

A shovel notable only in that it can dig soul sand more quickly than a normal shovel.

name="steelShovel";
id = config.getItemId("steelShovelID");
displayName = "Steel Shovel";
textureFile = "steelShovel.png";
full3d = true;

maxDamage = 300;              //How many actions the tool can perform then break.
damage[0] = 4;                //The damage to an entity hit with item.
efficiency[0] = 7.0;          //The speed that the shovel digs.
harvestLevel = 2;             //Harvests what an iron shovel can harvest
toolClass = "shovel";         //Tells Minecraft the tool is a shovel.
efficiencyBlocks = "88";      //Quickly digs soulsand.
repairable = true;            //Allows the tool to be repaired
onBlockDestroyed[0] = "itemstack.damageItem(1);";
                                //this trigger damages the shovel when the
                                //player destroys a block with it.
onHitEntity[0] = "itemstack.damageItem(2);";
                     //This trigger damages the shovel when it's used to deal
                     //damage to a mob.

Note that in the above example the harvestblocks attribute is omitted. If that attribute is the same as the toolclass, then harvestblocks is redundant and it's not necessary to include it.

Axe

An axe that can be easily used as a weapon due to its high damage potential.

name="battleaxe";
id = config.getItemId("battleaxeID");
displayName = "Battle axe"
textureFile = "battleaxe.png";
full3d = true;

maxDamage = 192;        //How many actions the tool can perform then break.
damage[0] = 6;          //The damage to an entity hit with item.
efficiency[0] = 5.5;    //The speed the battleaxe cuts through wood.
harvestLevel = 2;       //Harvests what an iron tool of the same type can.
toolClass = "axe";      //Tells Minecraft this tool is an axe.
repairable = true;      //Allows the tool to be repaired.
onBlockDestroyed[0] = "itemstack.damageItem(1);";
                                //this trigger damages the axe when the
                                //player destroys a block with it.
onHitEntity[0] = "itemstack.damageItem(1);";
                     //This trigger damages the axe when it's used to deal
                     //damage to a mob, but not as much as a normal axe
                     //is damaged by the same action.

Note that the harvestblocks and efficiency blocks are missing. If they're set the same as "toolclass", these attributes are redundant and thus not included.

Sword

An awesome sword that can set enemies ablaze without the need to be enchanted.

name="flameBrand";
id = config.getItemId("flameBrandID");
displayName = "Flame Brand";
textureFile = "flameBrand.png";
full3d = true;

maxDamage = 121;        //How many actions the tool can perform then break.
damage[0] = 4;          //The damage to an entity hit with item.
efficiency[0] = 1.5;    //Swords don't usually help harvest blocks.
repairable = true;
harvestLevel = 1;       //Again, this is pretty much useless as swords aren't 
                        //digging tools.
toolClass = "sword";    //"Sword" hasn't been properly implemented yet.
onBlockDestroyed[0] = "itemstack.damageItem(2);";
                        //this trigger damages the sword when the
                        //player destroys a block with it.

onHitEntity[0] = "living.setOnFire(200); itemstack.damageItem(1);";
                     //This trigger causes the mob being hit to burst into
                     //flames for 10 seconds. It also damages the sword
                     //upon hitting the mob.
onRightClick[0] = "player.setItemInUse();";  //Makes right click call the 'usingAction' attribute
usingAction[0] = "block"; //Causes the Player to "block" with the sword when using. See line above.

addToCreative[0] = true;
creativeTab[0] = "combat";

As with the previous two examples, several redundant attributes have been omitted as there's no point in adding them.

Hoe

A basic hoe that tills the dirt.

name="Harvest Hoe";
type="normal";
textureFile = "harvestHoe.png";
full3d = true;

maxuses = 404;            //How many actions the tool can perform then break.
repairable = "true";
toolclass = "hoe";        //This value is pretty meaningless as a hoe isn't
                          //a block-harvesting tool.
onBlockDestroyed[0] = "itemstack.damageItem(2);";
                                //this trigger damages the hoe when the
                                //player destroys a block with it.
onHitEntity[0] = "itemstack.damageItem(2);";
                     //This trigger damages the hoe when it's used to deal
                     //damage to a mob.
onUse[0] = "var curBlock = world.getBlockName(position); if(curBlock == 'minecraft:grass' || curBlock == 'minecraft:dirt') { world.setBlock(position, 'minecraft:farmland'); itemstack.damageItem(1); player.swingItem(); }"
//The above line must all be in a single line, or else ported to a .script file.
//This line makes it so that the hoe tills the dirt when rightclicked.
//It also damages the hoe upon doing so and play animation of swing item.

Extra Notes

damageItem - itemstack vs player
Using itemstack.damageItem instead of player.damageItem to damage tools has two major advantages. First, item.damageItem is shorter than player.damageItem. Here are both methods side by side for comparison

player.damageItem(player.getCurrentSlot(), 1);
itemstack.damageItem(1);

Second, itemstack.damageItem does not get used while in creative mode, so you can test items without worrying about replacing them. Unfortunately, sometimes this can confuse players into thinking the damageItem line doesn't work.

The player.damageItem version does still have it's uses though. The main reason to remember the player version is that almost no block events have access to itemstack functions, so if you want to damage the item from a block, you need to use this version.

CS1
Older Examples and Information for Custom Stuff 1.



Pickaxe (CS1)

A simple pickaxe that is capable of digging through obsidian, despite not being of diamond quality. It also breaks much more quickly when used as a weapon, representing a 'flaw' in its parent material.

name="Emerald Pickaxe";
id=1002;
type="normal";
iconfile="customstuff.png";
iconindex=33;
maxuses=1562;
damage=5;
efficiency=7.5;      //The speed that the pickaxe digs
harvestblocks="pickaxe, 49"; //Which blocks are harvested. 49=ID of obsidian
efficienyblocks="pickaxe, 49"; //Efficient as pickaxe, and also v. obsidian.
repairable="true";   //The tool can be repaired.
harvestlevel=2;      //Blocks that can be harvested are same as iron
toolclass="pickaxe"; //Sets the type of this particular tool to "pickaxe"
blockdestroyed = "player.damageItem(player.getCurrentSlot(), 1);";
                     //This blockdestroyed trigger shown here damages the
                     //pickaxe when it breaks a block.
hitmob = "player.damageItem(player.getCurrentSlot(), 4);";
                     //This trigger damages the pickaxe when it's used to
                     //deal damage to a mob.

Shovel (CS1)

A shovel notable only in that it can dig soul sand more quickly than a normal shovel.

name="Steel Shovel";
id=1003;
type="normal";
iconfile="customstuff.png";
iconindex=34;
maxuses=300;
damage=2;
efficiency=7.0;      //The speed that the shovel digs.
efficiencyblocks="shovel, 88"; //Quickly digs like shovel, and also soulsand.
repairable="true";              //Allows the tool to be repaired
harvestlevel=2;                 //Harvests what an iron shovel can harvest
toolclass="shovel";             //Tells Minecraft the tool is a shovel.
blockdestroyed = "player.damageItem(player.getCurrentSlot(), 1);";
                                //this trigger damages the shovel when the
                                //player destroys a block with it.
hitmob = "player.damageItem(player.getCurrentSlot(), 2);";
                     //This trigger damages the shovel when it's used to deal
                     //damage to a mob.

Note that in the above example the harvestblocks attribute is omitted. If that attribute is the same as the toolclass, then harvestblocks is redundant and it's not necessary to include it.

Axe (CS1)

An axe that can be easily used as a weapon due to its high damage potential.

name="Battleaxe";
id=1004;
type="normal";
iconfile="customstuff.png";
iconindex=35;
maxuses=192;
damage=6;
efficiency=5.5;         //The speed the battleaxe cuts through wood.
repairable="true";      //Allows the tool to be repaired.
harvestlevel=2;         //Harvests what an iron tool of the same type can.
toolclass="axe";        //Tells Minecraft this tool is an axe.
blockdestroyed = "player.damageItem(player.getCurrentSlot(), 1);";
                                //this trigger damages the axe when the
                                //player destroys a block with it.
hitmob = "player.damageItem(player.getCurrentSlot(), 1);";
                     //This trigger damages the axe when it's used to deal
                     //damage to a mob, but not as much as a normal axe
                     //is damaged by the same action.

Note that the harvestblocks and efficiency blocks are missing. If they're set the same as "toolclass", these attributes are redundant and thus not included.

Sword (CS1)

An awesome sword that can set enemies ablaze without the need to be enchanted.

name="Flame Brand";
id=1005;
type="normal";
iconfile="customstuff.png";
iconindex=36;
maxuses=121;
damage=4;
efficiency=1.5;         //Swords don't usually help harvest blocks.
repairable="true";
harvestlevel=1;         //Again, this is pretty much useless as swords aren't 
                        //digging tools.
toolclass="sword";       //"Sword" hasn't been properly implemented yet.
blockdestroyed = "player.damageItem(player.getCurrentSlot(), 2);";
                                //this trigger damages the sword when the
                                //player destroys a block with it.
hitmob = "living.setOnFire(200); player.damageItem(player.getCurrentSlot(), 1);";
                     //This trigger causes the mob being hit to burst into
                     //flames for a few seconds. It also damages the sword
                     //upon hitting the mob.

As with the previous two examples, several redundant attributes have been omitted as there's no point in adding them.

Hoe (CS1)

A basic hoe that tills the dirt.

name="Harvest Hoe";
id=1006;
type="normal";
iconfile="customstuff.png";
iconindex=36;
maxuses=404;
repairable="true";
toolclass="hoe";        //This value is pretty meaningless as a hoe isn't
                        //a block-harvesting tool.
blockdestroyed = "player.damageItem(player.getCurrentSlot(), 2);";
                                //this trigger damages the hoe when the
                                //player destroys a block with it.
hitmob = "player.damageItem(player.getCurrentSlot(), 2);";
                     //This trigger damages the hoe when it's used to deal
                     //damage to a mob.
rightclick = "if(world.getBlockId(origin) == 2 || world.getBlockId(origin) == 3){world.hoeBlock(origin);player.damageItem(player.getCurrentSlot(), 1);}";
//The above line must all be in a single line, or else ported to a .script file.
//This line makes it so that the hoe tills the dirt when rightclicked.
//It also damages the hoe upon doing so.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.