Posted August 13, 201411 yr 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
August 14, 201411 yr 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 Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 14, 201411 yr Author Thanks for the response ! 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?
August 14, 201411 yr Hey I just edited my above example, have you tried using the "damageItem(int,EntitiyLivingBase)" method? I tossed that in the edited code above. Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 14, 201411 yr 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.
August 14, 201411 yr did you push your changes? so I can check the github at the code again? Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 14, 201411 yr Author Sorry, I'm starting school again and I've been busy. Its just been updated.
August 14, 201411 yr I just finished my college classes, so In know the feels. Github is down apparently I'll check it later to see if it's up. Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 14, 201411 yr 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); Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 15, 201411 yr 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.