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.

mankeeey

Members
  • Joined

  • Last visited

  1. How can I see what block is originaly broken? If I know that, I can see if it can harvest or not. Because when I destroy dirt it destroys all stone near it atm. That's bugging me. EDIT: nvm found it and fixed it. This is what I did. @Override public boolean onBlockDestroyed(ItemStack par1ItemStack, World world, int par1, int x, int y, int z, EntityLivingBase player) { int numBlocks = 0; Block firstBlock = Block.blocksList[world.getBlockId(x, y, z)]; if(firstBlock != null) { if(this.canHarvestBlock(firstBlock, par1ItemStack)) { for(int i=-1;i<=1;i++) { for(int j=-1;j<=1;j++) { for(int k=-1;k<=1;k++) { int l = world.getBlockId(x+i, y+j, z+k); Block block = Block.blocksList[l]; if(block != null) { System.out.println("block: " + block.getUnlocalizedName()); System.out.println("can: " + par1ItemStack.canHarvestBlock(block)); System.out.println("numBlocks: " + numBlocks); if(this.canHarvestBlock(block, par1ItemStack)) { int par6 = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, par1ItemStack); block.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x+i, y+j, z+k), par6); world.setBlockToAir(x+i, y+j, z+k); numBlocks++; } } } } } par1ItemStack.damageItem(numBlocks/3, player); } } //Block block = Block.blocksList[l] return false; }
  2. EDIT: It works, thanks. The only problem is when I destroy dirt with it, it destroys rock material around it. I'm looking into it. If you have a quick fix for it, It's always welcome. EDIT 2: I found why it still deleted stone after breaking dirt. You checked if it could harvest every time, so for stone it would say true. Here is the code I have now. This fix might help you out aswell. @Override public boolean onBlockDestroyed(ItemStack par1ItemStack, World world, int par1, int x, int y, int z, EntityLivingBase player) { int numBlocks = 0; for(int i=-1;i<=1;i++) { for(int j=-1;j<=1;j++) { for(int k=-1;k<=1;k++) { int l = world.getBlockId(x+i, y+j, z+k); Block block = Block.blocksList[l]; if(block != null) { System.out.println("block: " + block.getUnlocalizedName()); System.out.println("can: " + par1ItemStack.canHarvestBlock(block)); if(this.canHarvestBlock(block, par1ItemStack)) { int par6 = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, par1ItemStack); block.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x+i, y+j, z+k), par6); world.setBlockToAir(x+i, y+j, z+k); numBlocks++; } else { return false; } } } } } par1ItemStack.damageItem(numBlocks/3, player); //Block block = Block.blocksList[l] return false; } What I'm thinking now is. When I destroy stone and there is dirt next to it. it will stop the method.
  3. Hi, I want to make a pickaxe that can mine more than one ore at once. Example: If you mine a block, the blocks next to it will be mined aswell. I have no idea how to implement this into my pickaxe class. Kind regards Mankeeey

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.