Jump to content

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


Recommended Posts

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

Posted

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

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