API to support adding in new upgrade items for machines

  • I have some ideas for upgrade items- so that I can get people off their Advanced Machine dependency. Unfortunately at present it looks like there's no way to hook TileEntityMachine when there are upgrade items.


    What I would like to be able to do is create new "Upgrader" items, probably event driven, with visibility into the base TileEntityMachine.


    Here's a simple proposal.



    This is just a sketch of an idea for a new API to support modders creating new upgrade items without having to hack base IC2 code. Thoughts?

  • it is not how API work\shoud work.
    we need access to every method of every TE object via API to change whatever we want.
    onInventoryUpdate shoud be entrypoint for external code.
    Whithout such access API will only allow minor amount of predefined mods.


    For exsample:
    Hook into getResultFor will allow user to change output of machine, maybe i want "heatboost" - smelt iron directly into refined form.
    Or minifurnace to macerate stuff into ingots.
    Only "before" and "after" callbacks wont allow anything expect defined options.


    Hook into "canoperate" will allow energygenerator mods, to allow machine operate without external power.


    and soo on.

    • Official Post

    As well, APIs are meant to be sole-standing... With that API you cant do anything, because TileEntityMachine isnt a component of the API.


    It's impossible to API stuff like that... because we can only hand out hooks for strictly defined operations... which actually equals 1 Upgrade each we could just implement instead.



    F.e. crops were coded with API in mind from the very beginning, that's the reason their API is considerable mighty.

  • Alblaka,
    It's not hard to deal with the TileEntityMachine not being in the API itself- you provide an interface with some typical accessors as an interface that IS in the API and use that instead.


    I realise that crops are planned for API extension and IC2 core isn't, but I've actually had to do exactly this kind of API retrofitting for my day job, on oh, about half a dozen occasions.


    I agree that there might be some constraints to the other poster's point, but to be honest, I think it's a shame if we cannot code up new upgrade modules. It means I have to go back to the old, not very fun, way of doing something like an advanced machine. I suspect, Alblaka, to your point about "we would add in all the upgrade modules", are you planning a redstone engine based "extractor" module to automatically put output into a neighbouring chest or BC pipe (this was my idea for replacing the old advanced machines mod by the way)?


    I also had ideas about "lockin" type modules, whereby you could lockin certain types of machine for certain jobs. For example: 1 macerator per ore type - to try and help prevent overload. Also a miniature input extension module. I think all of these are possible simply with the api ideas above.

  • without low level access API will allow only to change and combine already implemented mods, this is not very fun and mostly useless - much more viable option to code your own machine with everything included as TE code and simple recipes for t2 machines - electric furnace + randomitem = t2 electric furnace with full access to all methods.