Generator help

  • Hi, Im trying to create a generator, but I dont understand some functions, as addedToEnergyNet, and I wonder if someone could tell me what else do I need to implement except for IEnergySource, Im just trying to create an easy generator, dont need GUI and IWrenchable, Thanks.

  • I haven't actually implemented this myself, so can't speak to the result. Nonetheless, I think you want to be looking at ic2.api.EnergyNet, specifically so you can use addTileEntity() to add your generator to the ENet, removeTileEntity() to take it out again when the TE unloads, and emitEnergyFrom() to actually output energy.


    Anything else you want to add on is purely your TileEntity's problem, as far as I can tell. Implementing ic2.api.IEnergyEmitter may also help (the TileEntityBaseGenerator implementation is just returning true for emitsEnergyTo() at all times).

  • So, you think the block could emit power all by its lonesome? That might work... but I don't think the EnergyNet will be terribly happy with that. Really, a TileEntity is such a cheap thing, you might as well have it.

  • You must have TileEntity for your generator, even if you don't want gui (anyways, you need to have updateEntity() and invalidate() for energyNet and IEnergySource (or IEnergyEmitter, i dont remember)). Go to Advanced Solar Panels addon and explore Quantum Generator's code.