Posted April 12, 20178 yr Hi, I'm wondering how I can transfer energy from a producer to a consumer via a cable. public class TileEntityCable extends TileEntity implements ITickable { // kind of wrapper for Tesla and ForgeEnergy, extends EnergyStorage from Forge, no methods added public final EnergyManager container; public TileEntityCable() { this.container = new EnergyManager(1, 1); // capacity 1, maxReceive and maxExtract 1 } @Override public void update() { boolean hasUpdated = false; if(this.hasWorld() && !this.world.isRemote) { hasUpdated = true; final TileEntity tileEntity = this.getWorld().getTileEntity(this.getPos().offset(EnumFacing.DOWN)); // TODO all other directions if(tileEntity != null && !tileEntity.isInvalid()) { this.container.extractEnergy(10, false); // TODO } } if(hasUpdated) {// save changes to disk IBlockState state = this.getWorld().getBlockState(this.getPos()); this.getWorld().notifyBlockUpdate(this.getPos(), state, state, 3); this.markDirty(); } } // TODO: getCapability & hasCapability } My problems: searching for a better way to handle all directions How can I transfer energy from a producer like a Solar Panel into cable a which links to cable b and c and from cable c into the consumer, for example an electric furnance. Ok, found a solution: this.container.receiveEnergy(storage.extractEnergy(1, false), false); Thx in advance. Bektor Edited April 13, 20178 yr by Bektor Developer of Primeval Forest.
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.