set and get specific ic2-blocks..

  • Hi,
    i'm about to learn IC2-modding.
    How do I put one specific IC2-block to the world?
    Let's say I want to put a block of Uranium or a Bronze Block to the world, with vanilla blocks I'm doing it by:


    world.setBlock(x,y,z, Blocks.bedrock);

    I tried to do it like this:


    world.setBlock(x,y,z, IC2Items.getItem("bronzeBlock"));

    but this won't work.
    getBlock otherwise returns this:


    ic2.core.block.BlockMetal@756ba7 and Metadata=0

    what of corse doesn't work with setBlock...


    anyone?
    -thanks...


  • Meh, I wasn't looking at the api very often.

  • Starting from 1.7 the preferred method to get a block is using the registry, e.g. something like this:
    GameData.getBlockRegistry().getRaw("IC2:blockMetal")


    You can get the block name and metadata by using ic2's debug tool (/give <name> IC2:itemDebug). This also applies to items.

  • Starting from 1.7 the preferred method to get a block is using the registry, e.g. something like this:
    GameData.getBlockRegistry().getRaw("IC2:blockMetal")


    You can get the block name and metadata by using ic2's debug tool (/give <name> IC2:itemDebug). This also applies to items.


    Huh, I guess you could do it like that.