Jump to content

Changing Values of ItemStacks(Speed, durability, etc.) during runtime


BURN447
 Share

Recommended Posts

I'm creating a modifier system to tools, which I've mentioned a few times here, and I'm trying to edit some of these values. However, due to passing in an ItemStack, I cannot figure out how to cast it into the type of Item that I can modify. How would I go about modifying these values in my capability. One theory I've had is declaring those variables in the capability and then setting the defaults in the ItemClass, but I'm not 100% sure how to do that.

Link to comment
Share on other sites

If I was trying to change the efficiency of a tool, there is a base value in the Item class. for an individual ItemStack, what is the accepted way to edit the speed of a tool. I haven't been able to find any resources online

Link to comment
Share on other sites

https://github.com/BURN447/DartcraftReloaded/blob/master/src/main/java/burn447/dartcraftReloaded/Items/Tools/ItemForcePickaxe.java

 

This is my Current tool class. I am overriding the methods, but when there is a specific tag, probably NBT, I'm trying to change the efficiency value. I'm also getting a stack using getStackInSlot, which gives me an itemstack, and if it belongs to my mod, it's supposed to add a modifier

Link to comment
Share on other sites

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

 Share



×
×
  • Create New...

Important Information

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