Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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.

  • Author

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.