Jump to content

Reversed damage bar & Stop bobbing when damage changes [UNSOLVED] [1.7.10]


Recommended Posts

Posted

Hello everyone.

 

So, I am creating an item that can be charged with energy (my own custom energy), and when it is on (switched on by holding control and clicking), this energy is constantly drained, at a rate of 1 per tick (it stores 9600, so that is enough for 6 minutes of use.) I have been using things like stackTagCompound to store data like this in the item. Now, the way I am decreasing the energy, is with stack.setItemDamage(stack.getItemDamage - 1); But there are two problems with this, one of which is quite strange.

 

one: the item is constantly bobbing up and down in the players hand when the damage is changing, I would like to stop this from happening, or have an alternative way to decrease the stored energy. Is there a method I can override to stop this?

 

two: (quite strange) the damage bar is reversed... so when it is empty, the damage bar shows full, and when it is full, the damage bar shows empty, and as it is filling, the damage bar goes down, and visa versa.

 

So, how do I fix these two things? preferably, I wouldn't like to use item damage, I would like to use a stored value in stackTagCompound, and have a damage bar displayed for this. But is that the best way to do it? I'm not sure.

 

thanks.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Posted

Okay, thanks.

 

I don't think I explained the bobbing very well, I think you have misunderstood what I meant. It is hard to explain, but when an items damage is charging (not just for my item), it bobs up and down. e.g. I can't remember what the mod is called, It may just be "chargepads" but, there is a mod that adds charge pads, and when you stand on one, it charges things like IC2 armour or electric items in the players inventory like batteries, and when you hold an electric item while it is charging, it does the same thing, it bobs up and down. I think this is a vanilla thing. maybe it is because it thinks for each damage value change, you have changed item or something.

 

But thanks anyway. If I can make it display a damage bar for a value that isn't the actual items damage, then it shouldn't bob up and down.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

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.