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.

Featured Replies

Posted

So I've been using this sort of code for my 3 by 3 by 3 pickaxe

if(world.getBlock(x, y, z) == world.getBlock(x+1, y, z) && world.getBlock(x+1, y, z).isToolEffective("pickaxe", 3))

.isToolEffective("pickaxe", 3) isn't really working well for me, since I'd like it to mine Obsidian, Fences, Stairs, and everything that is mined faster with a diamond pickaxe. For redstone ore, I've currently been using an awkward boolean system, but it's under control. I don't want to code a awkward fix for all of these other blocks either.

You are checking

world.getBlock(x, y, z).isToolEffective("pickaxe", 3)

, right? If so, then

world.getBlock(x+1, y, z).isToolEffective("pickaxe", 3)

is redundant, as you also check that

world.getBlock(x, y, z)

and

world.getBlock(x+1, y, z)

are the same block (and if the pickaxe is effective against the block it is effective against the block).

  • Author

Lmao, I thought that thru already. Meh, I like it like that... Lmao what if there's a block that is only affected by pickaxes if the damage is 1 or something... heh... That also reminds me to add a damage checker.

I was not quite sure what you were asking. To be honest I am still not 100%, but do you want

ItemPickaxe#canHarvestBlock(IBlockState)

?

  • Author

Pretty much, except instead of ItemPickaxe I want Block, and CanHarvestBlock makes it so that I can basically harvest anything... So let me try to explain this much more clearly...

 

I would like to know a way I can check if the block is broken faster by a diamond pickaxe (Level 3 Pickaxe). I was currently using getBlock().isToolEffective("pickaxe", 3) (From memory), but it doesn't work for stairs, obsidian, end_stone, etc.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.