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.

[1.7.10][SOLVED] Cant access EnergyStorage in a IEnergyHandler from GUI

Featured Replies

Posted

I am trying to display a energy bar that shows the total energy I have. I have a tile entity with a IEnergyHandler implementation and I have a single EnergyStorage variable. I am trying to access it from my GUI to make the energy bar, but everytime I access it I get that the energy stored is 0, and when I check the value of the energy stored inside of the TileEntity I get that it is fully charged.

 

So in summary:

Energy that I get in the TileEntity - 25,600

Energy that I get in the GUI        -  0

 

Tile Entity - https://github.com/Raizunne/Miscellany/blob/master/main/java/com/raizunne/miscellany/tileentities/TileEntityFoodPackager.java

GUI - https://github.com/Raizunne/Miscellany/blob/master/main/java/com/raizunne/miscellany/gui/GuiFoodPackager.java

 

Exta - Here's what my machine does! - http://www.gfycat.com/GlumBreakableIbisbill

One thing to note is that on a server the values you give to sendCraftingToCrafters (I think that's the method I'm not at my ide) is truncated to a short so if your max energy is over 32k you will need to find a way around that. My solution was to divide my energy value by x on the sending side and multipley it by x on the receiving side (x is the minimum value you need to get your max energy under 32k) this isn't as acurate but its close enough for my purpose

I am the author of Draconic Evolution

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.