The Meaning of Life, the Universe, and Everything.
Join Date:
6/22/2012
Posts:
52
Minecraft:
clock_lord
Member Details
I am trying to make a mod that makes it so wood drops bark(a new item I added) but no matter what I do it drops wood, heres the code:
package net.minecraft.src;
import java.util.List;
import java.util.Random;
public class BlockWood extends Block
{
/** The type of tree this block came from. */
public static final String[] woodType = new String[] {"oak", "spruce", "birch", "jungle"};
public BlockWood(int par1)
{
super(par1, 4, Material.wood);
this.setCreativeTab(CreativeTabs.tabBlock);
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public int getBlockTextureFromSideAndMetadata(int par1, int par2)
{
switch (par2)
{
case 1:
return 198;
case 2:
return 214;
case 3:
return 199;
default:
return 4;
}
}
/**
* Determines the damage on the item the block drops. Used in cloth and wood.
*/
public int damageDropped(int par1)
{
return 0;
}
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
//public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
// {
// par3List.add(new ItemStack(par1, 1, 0));
// par3List.add(new ItemStack(par1, 1, 1));
// par3List.add(new ItemStack(par1, 1, 2));
// par3List.add(new ItemStack(par1, 1, 3));
// }
public int idDropped(int par1, Random par2Random, int par3)
{
return Item.bark.shiftedIndex;
}
Ah, have you created the Item "bark" yet? that might be the problem,
else try change return Item.bark.shiftedIndex; to Item.bark.itemID;
regards, Damien.
Yes I added bark but its just dropping wood like normal
As much as I absolutely hate it when people say this, this is one situation where it really should be used. Use ForgeModLoader if you plan on actually releasing this mod, as you should never release one where base classes are edited.
package net.minecraft.src;
import java.util.List;
import java.util.Random;
public class BlockWood extends Block
{
/** The type of tree this block came from. */
public static final String[] woodType = new String[] {"oak", "spruce", "birch", "jungle"};
public BlockWood(int par1)
{
super(par1, 4, Material.wood);
this.setCreativeTab(CreativeTabs.tabBlock);
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public int getBlockTextureFromSideAndMetadata(int par1, int par2)
{
switch (par2)
{
case 1:
return 198;
case 2:
return 214;
case 3:
return 199;
default:
return 4;
}
}
/**
* Determines the damage on the item the block drops. Used in cloth and wood.
*/
public int damageDropped(int par1)
{
return 0;
}
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
//public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
// {
// par3List.add(new ItemStack(par1, 1, 0));
// par3List.add(new ItemStack(par1, 1, 1));
// par3List.add(new ItemStack(par1, 1, 2));
// par3List.add(new ItemStack(par1, 1, 3));
// }
public int idDropped(int par1, Random par2Random, int par3)
{
return Item.bark.shiftedIndex;
}
}
Help?
Can I see code in 'Item.java'?
Yes I added bark but its just dropping wood like normal
Theres no other way to do this mod, it changes and removes features soo.....