Hi,
I am working on an addition to SkylordJoel's mod which improves compatibility. I wanted to add an electric version of one of his machines, the slicer. So how would I do this, would I just add 'IEnergySink' to the list of imports in the TileEntity? Thanks.
Creating a basic electric machine
-
-
I think you need more then EnergySink... Add max aceptable EU, storage EU(little because every machine have internal buffer for storing energy in graphic way at that "red strike" :D)
Well, API explain it very good and precisely. Everything is commented.I mean something like that what i found :))
@Override
public boolean acceptsEnergyFrom(TileEntity emitter,
ForgeDirection direction) {
return false;
}
@Override
public double demandedEnergyUnits() {
return 0;
}
@Override
public double injectEnergyUnits(ForgeDirection directionFrom, double amount) {
return 0;
}
@Override
public int getMaxSafeInput() {
return 0;
} -
In the API look for a class called BasicSink. (ic2.api.energy.prefab) It is by far the easiest way to make a machine.
At the top of your TileEntity (Right after the extends TileEntity line) add this:
private BasicSink electricSlicer = new BasicSink(this, <maxBufferPower>, <tier>)
Thats how you would get started. You would need to add more methods to get it to do anything useful.
If you look into that file there is an example TileEntity. Just copy, paste and edit what you need.
As far as Java goes, simply importing a class does not do anything. You need to do something in the actual code section.
The traditional way would be implementing IEnergySink, though you have to manage a lot of things from there. Thats where BasicSink comes in handy.
Hope that helps
-
Ahh, so that's how to do it. So what does tier mean (I assume the maxbufferpower is the internal energy storage)? So if I wanted it to be on par with IC2's basic machine tier what would I do?
-
Tier's are only information displaying texts for show you how much complex and good is machine in energy sources / storing energy / using.
Like if you can imagine: Batbox(Tier I), CESU(Tier II), MFE(Tier III), MFSU(Tier IV). Fixed that for you ~SpwnX
I hope it's understandable.