Jump to content

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


Recommended Posts

Posted

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.

Posted

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

Posted

I hadn't seen that comment, but where would I override those methods? Would I be declaring a new Instance of the item in the Capabilities class and then passing in the stack? 

Posted

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

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



×
×
  • Create New...

Important Information

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