Posted December 9, 201410 yr 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 http://i.imgur.com/J2keQOC.png[/img]http://i.imgur.com/YHnvIfh.png[/img]
December 9, 201410 yr 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
December 9, 201410 yr Author I will take that into account when making other machines! Thats a very ingenious way to do it Thanks for the advice! Also, did what ContainerFurance does, but the progress bar is not updating real time, do I have to call the updateProgressBar somewhere?. http://i.imgur.com/J2keQOC.png[/img]http://i.imgur.com/YHnvIfh.png[/img]
December 9, 201410 yr Author Here ya go - http://pastebin.com/dpaM659y http://i.imgur.com/J2keQOC.png[/img]http://i.imgur.com/YHnvIfh.png[/img]
December 9, 201410 yr Author Yup, that did it! Thanks again for the help! http://i.imgur.com/J2keQOC.png[/img]http://i.imgur.com/YHnvIfh.png[/img]
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.