IC² API and IC² Addon Creation. (The Code Part)

  • How should i use a variable "voltage" in

    Code
    double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)


    in new IC2 API? Should i make so, that my machines would explode themselves, if voltage is exceeded maximum level for current tier? Or this variable is nessesary only for transformators or so?

  • You typically ignore it, amount already accounts for it with the energy (amount) being voltage*current (*1 tick). It's for special purposes, not the average machine.


    I'm aiming to handle overload mostly outside the block to keep it consistent. The voltage parameter is suitable to e.g. let a lamp glow brighter or auto-transformers.


    Thank you for answer. You aiming for concept - more voltage - more faster work machine? So instead of "upgrade" item and "transformer" item we use a machine specified item in special slot - as "lv motor" "mv motor" or "lv heating coil" for furnance and so on?

  • sorry to revive old thread - but i found some useful info here ;) - anyway how new e-net will be solved ? - i like idea of more "real" solution like cable being capable of current (packets/tick) and voltage being isolation limit only. - is this the case of new e-net ? :) any disclosure how it will be done ?

    Inteligence is not everything - wisdom is more than that.
    "Survival is survival dammit.. don't give me this stinky cheated diamonds.. .. or else.." - by unknown hero

  • Hello,


    after trying to create the workspace I get a error...


    build.gradle:

    • Official Post
    Code
    compile 'net.industrial-craft:industrialcraft-2-2.6.195-ex110:api'

    Should go in the dependencies block below minecraft, not in the buildscript one.

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

  • Hello,

    I use OreDictionary.WILDCARD_VALUE as Damage to energy crystal, but it doesn't work! It still need energy crystal with full energy. How do I do?

    MC:1.10.2

    IC2:2.6.249

    forge:1.10.2-12.18.3.2185

    Otherwise, the IC2 dev.jar version for coding test would crash when building the world.

    • Official Post

    For the Energy crystal try using:

    Code
    ItemStack energyCrystal = new ItemStack(IC2Items.getItemAPI().getItem("energy_crystal"), 1, OreDictionary.WILDCARD_VALUE);

    Because of the way electric items deal with damage setting the damage in the first place might not actually set the damage properly when using the setter.


    Especially when crafting with electric items, but not only there, you might want to use IC2's recipes (Recipes.advRecipes.addRecipe()), which will copy over the energy level of the input items into the output items.



    Regarding the crash you sent there. That's caused by you using a different mcp mapping than we do. In minecraft 1.8 and above, forge allows you to use the normal version of the mod in the dev environment. Try using the normal version.

  • Thanks a lot! It worked!:D


    About IC2's recipes (Recipes.advRecipes.addRecipe()) , how to use it correctly?
    I just replace GameRegistry.addRecipe to Recipes.advRecipes.addRecipe, it crashed .Caused by: java.lang.NullPointerException

    I try to do some changes still crash....It's hard to debug for Object[] ...

  • My environment is using the normal version.

    I just build my mod and take the jar to a normal game. It's no problem!

  • Oh...Sorry for uncomplete log...Here is complete one:


    The load function is the Init function...:D I had renamed it.

    Code
    @Mod.EventHandlerpublic void load(FMLInitializationEvent event){}
    • Official Post

    Have you remembered to load after IC2 in the @Mod? Recipes.advRecipes is only set when IC2 does it's FMLInitializationEvent, so if you're using it at the same load event and before IC2 that would give you an NPE.

    145 Mods isn't too many. 9 types of copper and 8 types of tin aren't too many. 3 types of coffee though?

    I know that you believe that you understood what you think I said, but I am not sure you realise that what you read was not what I meant.


    ---- Minecraft Crash Report ----
    // I just don't know what went wrong :(


    I see this too much.

  • Hey guys,

    I make a simple electric item.

    When I take it on the chargepad, it looks like the player lift it up continuously until charge stop.

    I think the point is item tooltip update.

    How to fix it?

    Thanks!:D