Search in sources :

Example 1 with EventAwareContent

use of com.skelril.nitro.selector.EventAwareContent in project Skree by Skelril.

the class CustomBlockSystem method register.

// Invoked via reflection
@SuppressWarnings("unused")
private void register(Object block) {
    if (block instanceof Block && block instanceof ICustomBlock) {
        ((Block) block).setUnlocalizedName("skree_" + ((ICustomBlock) block).__getID());
        ((Block) block).setRegistryName("skree:" + ((ICustomBlock) block).__getID());
        GameRegistry.register((Block) block);
        ItemBlock itemBlock = new ItemBlock((Block) block);
        itemBlock.setUnlocalizedName("skree_" + ((ICustomBlock) block).__getID());
        itemBlock.setRegistryName("skree:" + ((ICustomBlock) block).__getID());
        GameRegistry.register(itemBlock);
        // Add selective hooks
        if (block instanceof EventAwareContent) {
            Sponge.getEventManager().registerListeners(SkreePlugin.inst(), block);
        }
        if (block instanceof GraveStone) {
            GameRegistry.registerTileEntity(GraveStoneTileEntity.class, "skree:grave_stone_ent");
        }
    } else {
        throw new IllegalArgumentException("Invalid custom item!");
    }
}
Also used : ICustomBlock(com.skelril.nitro.registry.block.ICustomBlock) ICustomBlock(com.skelril.nitro.registry.block.ICustomBlock) Block(net.minecraft.block.Block) ItemBlock(net.minecraft.item.ItemBlock) EventAwareContent(com.skelril.nitro.selector.EventAwareContent) GraveStone(com.skelril.skree.content.registry.block.container.GraveStone) ItemBlock(net.minecraft.item.ItemBlock)

Aggregations

ICustomBlock (com.skelril.nitro.registry.block.ICustomBlock)1 EventAwareContent (com.skelril.nitro.selector.EventAwareContent)1 GraveStone (com.skelril.skree.content.registry.block.container.GraveStone)1 Block (net.minecraft.block.Block)1 ItemBlock (net.minecraft.item.ItemBlock)1