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

Hello all!

I started working on my mod again, and whilst doing that I decided Id make a hammer (Note: I called it disassembler because at the time I thought it'd be less like a hammer. I was wrong so I will be changing that regardless). I've got it working mostly they way I like it except for these two problems:

1. Once the tool is used it takes 27 damage (Because it can break that many blocks at a time) and as far as I know , it does that, but it causes the durability bar to go crazy. After a couple uses the bar goes past the point where a normal tool would've broken, then goes bright red, then resets. (I can get screenshots if they are necessary)

2. I recently noticed that it is capable of breaking bedrock and other blocks that should be unbreakable so long as the block you originally struck was one of the blocks it is allowed to break. I'm really not sure why.

 

Here is my github repo(https://github.com/rbuxton1/ryansmod), the class in question is under ryansmod/common/tool/DiamondDisassembler. Thanks!

 

(Note: I really cant get

 for (int ix = -1; ix < 2; ix++)
    		 {
    			 for (int iy = -1; iy < 2; iy++) 
    			 {
    				 for (int iz = -1; iz < 2; iz++)
    				 {
    					 Block canIBreak = world.getBlock(ix, iy, iz);
                                                 if (canIBreak.equals(Blocks.cobblestone) || canIBreak.equals(Blocks.stone) || canIBreak.equals(Blocks.stonebrick) || canIBreak.equals(Blocks.sandstone))
                                                 {
                                                      world.func_147480_a(x+ix, y+iy, z+iz, true);
                                                      item.damageItem(1,player);
    					 }
    				 }
    			 }
    		 }

 

inside you have your item.setItemDamage(item.getItemDamage() + 27); in the triple forloop just make it add 1 not 27. that way it only procs when it works, might want to move it into the if statement too (if breaks something, damage myself, if not move on)

 

and the reason why it can break the unbreakable or untargeted is because you get your boolean then you just go to town with that. just as long as you broke one of the target blocks everything else is fair game. use your check right in the for loop nest

 

 

 

the item = null part may crash minecraft so hopefully you don't need it, but the idea is there

 

  • Author

Thanks for the response :D!

I played around with your code and it doesn't break the 'unbreakables' now, but it still wont die when the time is up. I figured that was what the item = null was about but it just didn't work. Anymore ideas?

  • Author

I take that back. I can only hit a 3x3 area twice. I even set max damage to 4000000 when it was 2000 and still it behaves strangely.

ah I see this is your error:

item.damageItem(item.getItemDamage() + 1, entity);

just use

item.damageItem(1, entity);

 

why is that killing it so fast well

 

break something once

0 + 0 + 1

break another

1 + 1 + 1

3 + 3 + 1

7 + 7 +1

15 + 15 + 1

so on and so forth the first number is the damage of the item already, the second is you grabbing the damage, then adding 1. It basically breaks faster the more you use it.

 

so just need

item.damageItem(1, entity);

  • Author

Oh, my mistake. I just tried this and I can confirm it works! Thanks a lot for all the help!

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.