How to Modify Repair Durability with Anvil Repair & AOE Mining to items?

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

ljfa

New Member
Jul 29, 2019
2,761
-46
0
Click the green bug next to the Run button. Switch to the Debug perspective, and watch the variables.
Well it's not quite that easy
Assuming you're using Eclipse you can do it like that:
Set a breakpoint at some point in the code (right click on the left side) where you would like to get a closer look at runtime, for instance at "onBlockStartBreak". When you launch Minecraft in debug mode (with the green bug) it will stop the game when the breakpoint gets reached. When you switch to the Debug perspective, you can step through the code line by line and examine the values of variables.
 

ReignOfMagic

New Member
Jul 29, 2019
55
0
0
Nope, only has a method named getHarvestLevel. Unless there's an odd version which adds that
Like I said I have no idea how it works. I found code similar to that from 1.5 i believe and am using it with slight modifications I came up with to get it to work.

Click the green bug next to the Run button. Switch to the Debug perspective, and watch the variables.
I see it, and am using it.

First attempt caused minecraft to freeze. (I had it at line 90 which is : int xRange = breakRadius;). Nothing too crazy happened in the variable window.
Second attempt wouldn't launch minecraft when I had a breakpoint selected.
Third Attempt: put it to line 123 ( return super.onBlockStartBreak(stack, x, y, z, player); ). Variables popped up on right side. were normal. Side hit was 2, the x-z range was 3 as it should be. This was the MOP:
HitResult{type=BLOCK, x=567, y=5, z=-1281, f=2, pos=(567.2881982383424, 5.655325997414046, -1281.0), entity=null}
The entity null part looks.. wrong.

For the Test tool its variables look correct.
...
Figured out i press the pause/play button to unfreeze minecraft.

When I had line 123 Selected a few things pop up in yellow in the variables tab. See ss here: http://imgur.com/4jHQ0x8

Line 138 had a lot of yellow lines in the variable tab as well (int meta = world.getBlockMetadata(x,y,z);
SS: http://imgur.com/hIef7D1
I'm not sure why dirt showed up as I was breaking a 3x3 cobble area. ...


When going through the debug tab and scrolling through all the various lines it seems to be calling on all bits of the code that would be the end of it telling it to do stuff. So I'm at a loss, unless you think it could be a specific area/line that isn't being called correctly.
 

ljfa

New Member
Jul 29, 2019
2,761
-46
0
Well given that you hit a block and not an entity, the field being null should be okay
The yellow just means that the variable has changed afaik.

Damn, I am too lazy to get your code and try myself... :p
 

ljfa

New Member
Jul 29, 2019
2,761
-46
0
Actually I notice now that your breakExtraBlock method actually doesn't break any blocks...looks like you only copied like half the thing...damn

So you see why mindlessly copypasting code can be bad ^^
 
Last edited:

ReignOfMagic

New Member
Jul 29, 2019
55
0
0
Actually I notice now that your breakExtraBlock method actually doesn't break any blocks...looks like you only copied like half the thing...damn

So you see why mindlessly copypasting code can be bad ^^
Yeah... I took too many things out. I re-copied all the code and fixed the bits I needed to and now everything is gravy, at least pickaxe wise. I'll attempt to get the shovel part working as well now!


Edit:
Got All tool types working currently. Including AOE Dual tool. So that is quite nifty!
 
Last edited: