isAddedToEnergyNet function HELP.

  • Hi, I have trying to get what isAddedToEnergyNet means, but seriously I have no idea, If someone could explain when I need to set it to return true or false, I would appreciate it, also If I need to add a function to emit the Energy to the Net, or the maxEnergyOutput does it automatically, thanks

  • Easy-to-say: if you set it to true, it will connect to a cable, otherwise not. Seriously, no one electric device could work without adding to the enet (and generators (IEnergyEmitters) and machines (IEnergySink)).


    You must connect device to energyNet always (in updateEntity method of course)
    Source example:

    Code
    public void updateEntity() {		super.updateEntity();
    		if (!this.addedToEnergyNet) {			EnergyNet.getForWorld(this.worldObj).addTileEntity(this);			this.addedToEnergyNet = true;		}	}


    And you also have to delete your TE from energy net in invalidate() method.

    Code
    public void invalidate() {		if (addedToEnergyNet) {			EnergyNet.getForWorld(worldObj).removeTileEntity(this);			addedToEnergyNet = false;		}
    		super.invalidate();	}