Jump to content

Recommended Posts

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

Posted

 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

 

Posted

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?

Posted

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);

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.