Posted February 2, 20169 yr Hi, I'm posting again. I've been working on the tech system in my mod and I currently working on pipes. These pipes are supposed to transfer energy out of any TileEntity that's a PowerProvider and into any TileEntity that's a PowerAcceptor. That seems to be working fairly well, except that when the pipe grabs energy from a PowerProvider, it is adding power to the pipe but not removing it from the Provider. Here's where the transferPower() function is called: https://github.com/AnZaNaMa/EnergyTools/blob/master/src/main/java/com/AnZaNaMa/EnergyTools/Entity/TileEntity/TileEntityPipe.java#L56 and here's the transferPower function: https://github.com/AnZaNaMa/EnergyTools/blob/master/src/main/java/com/AnZaNaMa/EnergyTools/api/Tech/PowerConnectable.java#L201 - Just because things are the way they are doesn't mean they can't be the way you want them to be. Unless they're aspen trees. You can tell they're aspens 'cause the way they are.
February 3, 20169 yr Hi, I'm posting again. I've been working on the tech system in my mod and I currently working on pipes. These pipes are supposed to transfer energy out of any TileEntity that's a PowerProvider and into any TileEntity that's a PowerAcceptor. That seems to be working fairly well, except that when the pipe grabs energy from a PowerProvider, it is adding power to the pipe but not removing it from the Provider. Here's where the transferPower() function is called: https://github.com/AnZaNaMa/EnergyTools/blob/master/src/main/java/com/AnZaNaMa/EnergyTools/Entity/TileEntity/TileEntityPipe.java#L56 and here's the transferPower function: https://github.com/AnZaNaMa/EnergyTools/blob/master/src/main/java/com/AnZaNaMa/EnergyTools/api/Tech/PowerConnectable.java#L201 public void subtractEnergy(int energy){ this.energyContained = this.energyContained + energy; } Its never helpful to add energy when you want to be removing it. I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!
February 3, 20169 yr Author oh yeah that might be a problem, but thats not what is going on. I had changed that to what it is because before I used -= and i thought maybe that was messing it up. It still does it when I fix that. - Just because things are the way they are doesn't mean they can't be the way you want them to be. Unless they're aspen trees. You can tell they're aspens 'cause the way they are.
February 3, 20169 yr Author I realized I was not syncing energy values from server to client, so I thought maybe adding that would fix the problem. The energy still doesn't transfer correctly. - Just because things are the way they are doesn't mean they can't be the way you want them to be. Unless they're aspen trees. You can tell they're aspens 'cause the way they are.
February 3, 20169 yr In the title you say that you cant reduce the energy stored on the pipe, while on the topic you wrote that you can add power to a pipe but it is not substracting that energy from the provider. I don't know how you set up your base tile entities classes and it would be good to actually answer this. Are your pipes considered energy providers?
February 3, 20169 yr Author Pipes are defined as neither PowerProviders nor PowerAcceptors. They are a child class of PowerConnectable which is the same class PowerProvider and PowerAcceptor branch off of. What's currently happening is that when I have a PowerProvider connected to a pipe, the function grabPower() is being called energy is being transferred into the pipe. However, the energy is not being removed from the PowerProvider. This is the function that is being called when the energy transfer takes place: https://github.com/AnZaNaMa/EnergyTools/blob/master/src/main/java/com/AnZaNaMa/EnergyTools/api/Tech/PowerConnectable.java#L202 - Just because things are the way they are doesn't mean they can't be the way you want them to be. Unless they're aspen trees. You can tell they're aspens 'cause the way they are.
February 4, 20169 yr Author FOUND IT! I was using an Energizer as my PowerProvider (because currently it's the only one) and I looked in the PowerProvider class. It had its own energyContained variable which the energizer was using, meaning I was changing the PowerConnectable energyContained and it was displaying the PowerProvider energyContained. I have since consolidated it into just the PowerConnectable class and removed the protected field from all field variables, then encapsulated them. - Just because things are the way they are doesn't mean they can't be the way you want them to be. Unless they're aspen trees. You can tell they're aspens 'cause the way they are.
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.