[Important] Developers: API documentation, Upcoming API improvements, API release

  • Edit: Deprecated, will replace with a newer Thread ~Greg
    [b]
    HTML Documentation:[/b]
    The documentation for the latest API (development version) classes is available at http://ic2api.player.to/ic2api/html/annotated.html


    1.8x changes


    Mod access:
    - Added Mass Fabricator amplifier and Scrap Box drop APIs, see Ic2Recipes


    1.7x changes


    New features:
    - The NetworkHelper class has been added to allow addons to access the features of our internal SMP data/event synchronization framework.
    - Various interfaces for Network Events and Data handling have been added to the API


    1.6x changes


    Mod access:
    - Items are now ItemStacks in an API class called Items. If you want to reference an IC2 item, just do it by its itemstack.
    - Macerator/Compressor/Extractor recipes are now added through Ic2Recipes. Ic2Recipes.addMaceratorRecipe(ItemStack,ItemStack), Ic2Recipes.addCompressorRecipe(ItemStack,ItemStack) and Ic2Recipes.addExtractorRecipe(ItemStack,ItemStack) will add a macerator, compressor or extractor recipe respectively, the first ItemStack being the input and the second one the output.
    - Dynamic recipe support. For example, when crafting a Mining Laser, the output EU charge of the mining laser will be the sum of the EU currently stored on both crystals. The code below is an example on how to use the dynamic crafting system, explaining would be kinda complex:

    Code
    1. Ic2Recipes.addCraftingRecipe(Ic2Items.miningLaser, "Rcc", "AAC", " AA", 'A', Ic2Items.advancedAlloy, 'C', Ic2Items.advancedCircuit, 'c', Ic2Items.energyCrystal, 'R', Item.redstone);
    2. Ic2Recipes.addShapelessCraftingRecipe(Ic2Items.insulatedCopperCableItem, Ic2Items.rubber, Ic2Items.copperCableItem);


    New features:
    - Recycler blacklist: Ic2Recipes.addRecyclerBlacklistItem(ItemStack/Item/Block) will add an item to the recycler's blacklist. Blacklisted items will not produce scrap no matter what.
    - Agriculture: You can make your own crops by extending CropCard and overriding the methods to your heart's content.

  • It looks like the new API breaks on the special case of Compressors placed next to an infinite water source producing snowballs. I get this error:



    The error originates from the first 'if' statement in this piece of code:


    Code
    1. private static ItemStack getOutputFor(ItemStack input, boolean adjustInput, List<Map.Entry<ItemStack, ItemStack> > recipeList) {
    2. for (Map.Entry<ItemStack, ItemStack> entry: recipeList) {
    3. if (entry.getKey().isItemEqual(input) && input.stackSize >= entry.getKey().stackSize) {
    4. if (adjustInput) input.stackSize -= entry.getKey().stackSize;
    5. return entry.getValue().copy();
    6. }
    7. }
    8. return null;
    9. }



    It may also be worth noting bcIntegration isn't loading, though I don't run BC.


    If I had to guess I'd say the entry in the input stack is null because the pump doesn't just produce water blocks.


    Right now my server is hard crashing because the Compressor keeps throwing this error before I can even get to it. I'll either need to fix the code myself or MCedit out the Compressor. A hotfix would be appreciated.

  • Oh sorry, there's another post with the same problem. RichardG says a hotfix is on the way. For some reason that post didn't come up when I did a google search for it. My Compressor is also sitting next to two pumps, as is mentioned in the post. Though only one Pump is touching the Compressor: Pump -> Pump -> Compressor.

  • So, I done one for 1.4x and was hoping to build one for 1.6x. But I've run into a bit of a snag doing this. I can't actually decompile IC2 anymore, at all. I'm getting some weird Class type errors- this isn't only a problem with IC2 either, it's also a problem with NEI as well (this makes NEI+MC1.1 unplayable too).


    I think it's something wrong with my setup, but the errors look pretty fundamental- as far as I can see, the .class files are subtly corrupted and can't properly load for a decompiler. This is very very weird.


    I'll keep you updated.

  • cpw :


    How are you attempting to decompile it? JD-GUI and fernflower fail, but I had success with jadretro and jad (which MCP use by default). jadretro has to be applied first, then jad, but it seems to work.

  • I have to admit, a new API while giving the modders the info may produce more add-ons.
    But really who knows, least those that read this will know why 1.7.x is taking as long as it is.


    Anyways I hope the API overhaul allows the mod and add-ons for it to run smoother or together better. (As if they dont already) But I love this mod and totaly willing to wait 2 month between updates if thats what it took.

  • Better if will be some example on use this API. Samples of: base generator, base machine, base storage, base cable. Examples will increase a quantity and quality mods.

  • I have a better question: How do/Can I use super classing to achieve those things?
    And how do you set up the compilation environment, both for super classing and just using the API? I get for the API I'll need the API source files in my source tree, but if my mod needs IC2 to work I'll also need that and how do I stop two copies of the API Class files from showing up and messing things up (One copy in the IC2 jar in my mods folder, another coming from the source copies in my source tree that will end up in the minecraft.jar)

  • I would like to make my own Terraformer Blueprint.
    I created an item which implements ITerraformerBP interface, but how can I make the item able to be inserted into Terraformer with right-click?

  • Hi there,
    I am a new Minecraft Coder, I am currently making my own Industrial/Medieval style mod, and I was wondering if I may get your permission to take you API, revamp it extremely, and then release it along with my mod(and I will not be stupid, and that I will mention this API along with a link to this post). I will understand if you wish to not grant me permission


    Sincerely,
    KKABCD



    I have decided to make my own API for energy, so just ignore this post

    The post was edited 1 time, last by kkabcd ().