function useItem(x,y,z,itemId,blockId,side) //Defines the function of useItem eg. itemId, and blockId, and setTitle..
{
if(itemId == 295) // If seeds on anything.
{
setTile(x,y+1,z,31); //Place tall grass above the block tapped.
addItemInventory(295,-1); //Removes one Seed form inventory.
}
else if(itemId == 267) //If Iron Sword on anything.
{
setTile(x,y+1,z,51); //Place fire the block above it.
{
else if(itemId == 287) //If String on anything.
{
setTile(x,y+1,z,30); //Place cobweb.
addItemInventory(287,-1); //Take away one String.
}
else if(itemId==282&&blockId==4) //If Mushroom Stew on cobblestone.
{
setTile(x,y,z,48); //Change it into Mossy Stone.
addItemInventory(282,-1); //Remove one Mushroom Stew from inventory.
}
else if(itemId==296&&itemId==1) //If Wheat on stone.
{
addItemInventory(295,3); //Give player seeds.
addItemInventory(296,-1); //Take away one Wheat.
}
else if(itemId==332) //If Snowball on anything.
{
setTile(x,y+1,z,78); //Place snow on top of it.
addItemInventory(332,-1); //Remove one Snowball from inventory.
}
else if(itemId==318&&blockId==42) //If Flint on a Iron Block.
{
setTile(x,y+1,z); //Put fire on top of the Iron Block
}
else if(itemId==352&&blockId==6) //If a bone on a sapling.
{
addItemInventory(352,-1); //Remove one bone from player inventory.
setTile(x,y,z,17); //Replace the sapling with wood.
setTile(x,y+1,z,17); //place a log above the sapling cords.
setTile(x,y+2,z,17); //Place a log two blocks above the sapling.
setTile(x,y+3,z,17); //Place a log three blocks above the sapling.
setTile(x,y+4,z,17); //Place a log four blocks above the sapling.
setTile(x,y+5,z,17); //Place a log five blocks above the sapling.
setTile(x,y+6,z,18); //Place a leaf block above the top wood block.
setTile(x+1,y+5,z,18); //Place a leaf block one block to the right of the fifth log.
setTile(x-1,y+5,z,18); //Place a leaf block one block to the left of the fifth log.
setTile(x-1,y+5,z+1,18); //Place a leaf block diagonally with the fifth log?
setTile(x+1,y+5,z-1,18); //Place a leaf block diagonally the other way with the fifth log?
setTile(x+1,y+4,z,18); //Place a leaf block one block to the right of the fourth log.
setTile(x-1,y+4,z,18); //Plave a leaf log on the left of the fourth log.
setTile(x,y+4,z+1,18);
setTile(x,y+4,z-1,18);
setTile(x,y+4,z+2,18);
setTile(x,y+4,z-2,18);
setTile(x+2,y+4,z,18);
setTile(x-2,y+4,z,18); //Basicly... it'll make a tree (I hope...).
setTile(x-1,y+4,z-1,18);
setTile(x+1,y+4,z+1,18);
setTile(x+1,y+3,z,18);
setTile(x-1,y+3,z,18);
setTile(x,y+3,z+1,18);
setTile(x,y+3,z-1,18);
setTile(x+1,y+3,z+1);
setTile(x-1,y+3,z-1);
}
}
At the last couple of setTile()'s you missed the block data.
Make sure you put that you want to set leaves. You just have setTile(x-1,y+3,z-1);
It needs to be setTile(x-1y+3,z-1,18);
Rollback Post to RevisionRollBack
Willing to work on Android apps or multi-platform games, see profile bio for information.
Founder and CEO of Temena Development
Twitter: @TemenaPE
Instagram: @ItsLiterallyMath
To post a comment, please login or register a new account.
Can someone please help me fix this?
Thanks!
//MattPocketEdition v.1
//By MattdaveMatt
//Date 11/19/2013
//Time 2:20-2:28
function useItem(x,y,z,itemId,blockId,side) //Defines the function of useItem eg. itemId, and blockId, and setTitle..
{
if(itemId == 295) // If seeds on anything.
{
setTile(x,y+1,z,31); //Place tall grass above the block tapped.
addItemInventory(295,-1); //Removes one Seed form inventory.
}
else if(itemId == 267) //If Iron Sword on anything.
{
setTile(x,y+1,z,51); //Place fire the block above it.
{
else if(itemId == 287) //If String on anything.
{
setTile(x,y+1,z,30); //Place cobweb.
addItemInventory(287,-1); //Take away one String.
}
else if(itemId==282&&blockId==4) //If Mushroom Stew on cobblestone.
{
setTile(x,y,z,48); //Change it into Mossy Stone.
addItemInventory(282,-1); //Remove one Mushroom Stew from inventory.
}
else if(itemId==296&&itemId==1) //If Wheat on stone.
{
addItemInventory(295,3); //Give player seeds.
addItemInventory(296,-1); //Take away one Wheat.
}
else if(itemId==332) //If Snowball on anything.
{
setTile(x,y+1,z,78); //Place snow on top of it.
addItemInventory(332,-1); //Remove one Snowball from inventory.
}
else if(itemId==318&&blockId==42) //If Flint on a Iron Block.
{
setTile(x,y+1,z); //Put fire on top of the Iron Block
}
else if(itemId==352&&blockId==6) //If a bone on a sapling.
{
addItemInventory(352,-1); //Remove one bone from player inventory.
setTile(x,y,z,17); //Replace the sapling with wood.
setTile(x,y+1,z,17); //place a log above the sapling cords.
setTile(x,y+2,z,17); //Place a log two blocks above the sapling.
setTile(x,y+3,z,17); //Place a log three blocks above the sapling.
setTile(x,y+4,z,17); //Place a log four blocks above the sapling.
setTile(x,y+5,z,17); //Place a log five blocks above the sapling.
setTile(x,y+6,z,18); //Place a leaf block above the top wood block.
setTile(x+1,y+5,z,18); //Place a leaf block one block to the right of the fifth log.
setTile(x-1,y+5,z,18); //Place a leaf block one block to the left of the fifth log.
setTile(x-1,y+5,z+1,18); //Place a leaf block diagonally with the fifth log?
setTile(x+1,y+5,z-1,18); //Place a leaf block diagonally the other way with the fifth log?
setTile(x+1,y+4,z,18); //Place a leaf block one block to the right of the fourth log.
setTile(x-1,y+4,z,18); //Plave a leaf log on the left of the fourth log.
setTile(x,y+4,z+1,18);
setTile(x,y+4,z-1,18);
setTile(x,y+4,z+2,18);
setTile(x,y+4,z-2,18);
setTile(x+2,y+4,z,18);
setTile(x-2,y+4,z,18); //Basicly... it'll make a tree (I hope...).
setTile(x-1,y+4,z-1,18);
setTile(x+1,y+4,z+1,18);
setTile(x+1,y+3,z,18);
setTile(x-1,y+3,z,18);
setTile(x,y+3,z+1,18);
setTile(x,y+3,z-1,18);
setTile(x+1,y+3,z+1);
setTile(x-1,y+3,z-1);
}
}
P.S. Please don't steal!
Make sure you put that you want to set leaves. You just have setTile(x-1,y+3,z-1);
It needs to be setTile(x-1y+3,z-1,18);
Willing to work on Android apps or multi-platform games, see profile bio for information.
Founder and CEO of Temena Development
Twitter: @TemenaPE
Instagram: @ItsLiterallyMath