Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited


  • Gender
  • Personal Text
    I am new!

Bobkarate's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. I want the block to display a chat message when it is right clicked with a certain item. I don't want to add the code from the item, though because i'll be using vanilla items, and I've got to change some values within the block. Any help would be greatly appreciated!
  2. When I try to place down my block with metadata, it always places down the first metadata. My BlockLeaf class: public class CanadiaLeaf extends BlockLeaves{ public static final String[][] leafTypes = new String[][] {{"LeafMaple", "LeafRedCedar"}, {"leafMapleOpaque", "leafRedCedarOpaque"}}; public static final String[] leaves = new String[] {"Maple", "RedCedar"}; protected void func_150124_c(World world, int x, int y, int z, int side, int meta) { if (meta == 1) { this.dropBlockAsItem(world, x, y, z, new ItemStack(Canadia.maplesap, 1, 0)); } } /** * Determines the damage on the item the block drops. Used in cloth and wood. */ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(Canadia.blockSapling); } public int damageDropped(int i) { return super.damageDropped(i) + 0; } /** * Get the block's damage value (for use with pick block). */ public int getDamageValue(World world, int x, int y, int z) { return world.getBlockMetadata(x, y, z); } /** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */ @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list) { for(int i = 0; i < leaves.length; i++){ list.add(new ItemStack(item, 1, i)); } } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconregister) { for (int i = 0; i < leafTypes.length; ++i) { this.field_150129_M[i] = new IIcon[leafTypes[i].length]; for (int j = 0; j < leafTypes[i].length; ++j) { this.field_150129_M[i][j] = iconregister.registerIcon(Canadia.MODID + ":" + this.getUnlocalizedName().substring(5) + leafTypes[i][j]); } } } @Override public IIcon getIcon(int side, int meta) { return (meta & 3) == 1 ? this.field_150129_M[this.field_150127_b][1] : this.field_150129_M[this.field_150127_b][0]; } @Override public String[] func_150125_e() { return leaves; } @Override public boolean renderAsNormalBlock() { return false; } @Override public boolean isOpaqueCube(){ return false; } @Override public boolean shouldSideBeRendered(IBlockAccess blockaccess, int x, int y, int z, int side){ return true; } } And my ItemBlockLeaf class: public class ItemLeafBlocks extends ItemBlock { public static final String[] leaves = new String[] {"Maple", "RedCedar"}; public ItemLeafBlocks(Block block) { super(block); this.setHasSubtypes(true); } public String getUnlocalizedName(ItemStack itemstack){ int i = itemstack.getItemDamage(); if (i < 0 || i >= leaves.length){ i = 0; } return super.getUnlocalizedName() + "." + leaves[i]; } public int getMetaData (int meta){ return meta; } } Thanks for your help!
  3. I'm pretty new to modding, but I was wondering if there was a way to drop multiple items when a vanilla block is destroyed with a modded item. Any help would be appreciated!
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.