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.

[1.9] this.setHarvestLevel() but you can break the block whitout the tool

Featured Replies

Posted

 

good days

im porting mi blocks and doors to 1.9 and realize something

 

well if i set in the constructor fro the block whith

this.setHarvestLevel("pickaxe", 3);

 

this means than the block can only be harvested whith peckaxes of at least level 3

but you still can break the block whith a wodden pickaxe

 

#####

if i wanna make this block only breakeable if is done whith the right tool and level

is there sme where something like an

this.setBreakLevel("pickaxe", 3);  or something that makes the block unbreakeable unless the right tool is used ???

 

You can't, that's not how vanilla works.  Vanilla assumes that any, and every block that can be broken can be broken by hand (given enough time).  You would know this if you'd ever actually played the game.

 

If you actually want to prevent the player from ever breaking a block that their tool can't harvest then you need to interrupt the action via the event system.

 

Also, spelling.  All of these are wrong:

peckaxes

breakeable

mi

im

wanna

sme

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

yap but

 

i wanna make this especific blocks from mi mod undestructible by bare hands, soo if you wanna pass here you have to doit whith the right tool or blow up the blocks

 

 

 

 

Subscribe to PlayerEvent.BreakSpeed

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.