Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Bobkarate

Members
  • Joined

  • Last visited

Everything posted by Bobkarate

  1. But how would I see if they were holding the item?
  2. 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!
  3. 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!
  4. 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!

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.