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.
Generator help
-
-
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).
-
Thank you so much, but I dont think I need a TileEntity, because I dont want use any GUI, and any slots, but Thank You So much.
-
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.
-
nope, you need a tile entity even if you don't want any slots or gui, the only bit you get to skip by not having one is the container and gui classes
-
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.