Search in sources :

Example 1 with Init

use of cpw.mods.fml.common.Mod.Init in project MineFactoryReloaded by powercrystals.

the class BackTools method load.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Init
public static void load(FMLInitializationEvent e) {
    if (!Loader.isModLoaded("mod_BackTools")) {
        FMLLog.warning("BackTools missing - MFR BackTools Compat not loading");
        return;
    }
    try {
        Class modBackTools = Class.forName("mod_BackTools");
        /*
			 *  addBackItem(Class itemClass, int orientation, boolean flipped)
			 *  orientation is 0-3, and rotates counterclockwise by 90 deg * orientation
			 *  flipped true for vertical flipping of the texture  
			 */
        Method addBackItem = modBackTools.getMethod("addBackItem", Class.class, int.class, boolean.class);
        if (addBackItem != null) {
            addBackItem.invoke(modBackTools, ItemSafariNetLauncher.class, 2, true);
            addBackItem.invoke(modBackTools, ItemSpyglass.class, 1, true);
            addBackItem.invoke(modBackTools, ItemFactoryHammer.class, 1, true);
        }
    } catch (Exception x) {
        System.out.println("Last updated for " + lastUpdated);
        x.printStackTrace();
    }
}
Also used : Method(java.lang.reflect.Method) Init(cpw.mods.fml.common.Mod.Init)

Example 2 with Init

use of cpw.mods.fml.common.Mod.Init in project MineFactoryReloaded by powercrystals.

the class MineFactoryReloadedCore method init.

@Init
public void init(FMLInitializationEvent evt) {
    instance = this;
    float meatNuggetSaturation = MFRConfig.meatSaturation.getBoolean(false) ? 0.1F : 0.2F;
    float meatIngotSaturation = MFRConfig.meatSaturation.getBoolean(false) ? 0.2F : 0.8F;
    conveyorBlock = new BlockConveyor(MFRConfig.conveyorBlockId.getInt());
    machineBlocks.put(0, new BlockFactoryMachine(MFRConfig.machineBlock0Id.getInt(), 0));
    machineBlocks.put(1, new BlockFactoryMachine(MFRConfig.machineBlock1Id.getInt(), 1));
    machineBlocks.put(2, new BlockFactoryMachine(MFRConfig.machineBlock2Id.getInt(), 2));
    factoryGlassBlock = new BlockFactoryGlass(MFRConfig.factoryGlassBlockId.getInt());
    factoryGlassPaneBlock = new BlockFactoryGlassPane(MFRConfig.factoryGlassPaneBlockId.getInt());
    factoryRoadBlock = new BlockFactoryRoad(MFRConfig.factoryRoadBlockId.getInt());
    factoryDecorativeBrickBlock = new BlockFactoryDecorativeBricks(MFRConfig.factoryDecorativeBrickBlockId.getInt());
    factoryDecorativeStoneBlock = new BlockDecorativeStone(MFRConfig.factoryDecorativeStoneBlockId.getInt());
    rubberWoodBlock = new BlockRubberWood(MFRConfig.rubberWoodBlockId.getInt());
    rubberLeavesBlock = new BlockRubberLeaves(MFRConfig.rubberLeavesBlockId.getInt());
    rubberSaplingBlock = new BlockRubberSapling(MFRConfig.rubberSaplingBlockId.getInt());
    railDropoffCargoBlock = new BlockRailCargoDropoff(MFRConfig.railDropoffCargoBlockId.getInt());
    railPickupCargoBlock = new BlockRailCargoPickup(MFRConfig.railPickupCargoBlockId.getInt());
    railDropoffPassengerBlock = new BlockRailPassengerDropoff(MFRConfig.railDropoffPassengerBlockId.getInt());
    railPickupPassengerBlock = new BlockRailPassengerPickup(MFRConfig.railPickupPassengerBlockId.getInt());
    rednetCableBlock = new BlockRedNetCable(MFRConfig.rednetCableBlockId.getInt());
    rednetLogicBlock = new BlockRedNetLogic(MFRConfig.rednetLogicBlockId.getInt());
    rednetPanelBlock = new BlockRedNetPanel(MFRConfig.rednetPanelBlockId.getInt());
    fakeLaserBlock = new BlockFakeLaser(MFRConfig.fakeLaserBlockId.getInt());
    vineScaffoldBlock = new BlockVineScaffold(MFRConfig.vineScaffoldBlockId.getInt());
    factoryHammerItem = (new ItemFactoryHammer(MFRConfig.hammerItemId.getInt())).setUnlocalizedName("mfr.hammer").setMaxStackSize(1);
    fertilizerItem = (new ItemFactory(MFRConfig.fertilizerItemId.getInt())).setUnlocalizedName("mfr.fertilizer");
    plasticSheetItem = (new ItemFactory(MFRConfig.plasticSheetItemId.getInt())).setUnlocalizedName("mfr.plastic.sheet");
    rawPlasticItem = (new ItemFactory(MFRConfig.rawPlasticItemId.getInt())).setUnlocalizedName("mfr.plastic.raw");
    rubberBarItem = (new ItemFactory(MFRConfig.rubberBarItemId.getInt())).setUnlocalizedName("mfr.rubber.bar");
    syringeEmptyItem = (new ItemFactory(MFRConfig.syringeEmptyItemId.getInt())).setUnlocalizedName("mfr.syringe.empty");
    syringeHealthItem = (new ItemSyringeHealth()).setUnlocalizedName("mfr.syringe.health").setContainerItem(syringeEmptyItem);
    syringeGrowthItem = (new ItemSyringeGrowth()).setUnlocalizedName("mfr.syringe.growth").setContainerItem(syringeEmptyItem);
    rawRubberItem = (new ItemFactory(MFRConfig.rawRubberItemId.getInt())).setUnlocalizedName("mfr.rubber.raw");
    machineBaseItem = (new ItemFactory(MFRConfig.machineBaseItemId.getInt())).setUnlocalizedName("mfr.machineblock");
    safariNetItem = (new ItemSafariNet(MFRConfig.safariNetItemId.getInt())).setUnlocalizedName("mfr.safarinet.reusable");
    ceramicDyeItem = (new ItemCeramicDye(MFRConfig.ceramicDyeItemId.getInt())).setUnlocalizedName("mfr.ceramicdye");
    blankRecordItem = (new ItemFactory(MFRConfig.blankRecordId.getInt())).setUnlocalizedName("mfr.record.blank").setMaxStackSize(1);
    syringeZombieItem = (new ItemSyringeZombie()).setUnlocalizedName("mfr.syringe.zombie").setContainerItem(syringeEmptyItem);
    safariNetSingleItem = (new ItemSafariNet(MFRConfig.safariNetSingleItemId.getInt())).setUnlocalizedName("mfr.safarinet.singleuse");
    upgradeItem = (new ItemUpgrade(MFRConfig.upgradeItemId.getInt())).setUnlocalizedName("mfr.upgrade.radius").setMaxStackSize(1);
    safariNetLauncherItem = (new ItemSafariNetLauncher(MFRConfig.safariNetLauncherItemId.getInt())).setUnlocalizedName("mfr.safarinet.launcher").setMaxStackSize(1);
    sugarCharcoalItem = (new ItemFactory(MFRConfig.sugarCharcoalItemId.getInt())).setUnlocalizedName("mfr.sugarcharcoal");
    milkBottleItem = (new ItemMilkBottle(MFRConfig.milkBottleItemId.getInt())).setUnlocalizedName("mfr.milkbottle").setMaxStackSize(16);
    spyglassItem = (new ItemSpyglass(MFRConfig.spyglassItemId.getInt())).setUnlocalizedName("mfr.spyglass").setMaxStackSize(1);
    portaSpawnerItem = (new ItemPortaSpawner(MFRConfig.portaSpawnerItemId.getInt())).setUnlocalizedName("mfr.portaspawner").setMaxStackSize(1);
    strawItem = (new ItemStraw(MFRConfig.strawItemId.getInt())).setUnlocalizedName("mfr.straw").setMaxStackSize(1);
    xpExtractorItem = (new ItemXpExtractor(MFRConfig.xpExtractorItemId.getInt())).setUnlocalizedName("mfr.xpextractor").setMaxStackSize(1);
    syringeSlimeItem = (new ItemSyringeSlime(MFRConfig.syringeSlimeItemId.getInt())).setUnlocalizedName("mfr.syringe.slime").setContainerItem(syringeEmptyItem);
    syringeCureItem = (new ItemSyringeCure(MFRConfig.syringeCureItemId.getInt())).setUnlocalizedName("mfr.syringe.cure").setContainerItem(syringeEmptyItem);
    logicCardItem = (new ItemLogicUpgradeCard(MFRConfig.logicCardItemId.getInt())).setUnlocalizedName("mfr.upgrade.logic").setMaxStackSize(1);
    rednetMeterItem = (new ItemRedNetMeter(MFRConfig.rednetMeterItemId.getInt())).setUnlocalizedName("mfr.rednet.meter").setMaxStackSize(1);
    rednetMemoryCardItem = (new ItemRedNetMemoryCard(MFRConfig.rednetMemoryCardItemId.getInt())).setUnlocalizedName("mfr.rednet.memorycard").setMaxStackSize(1);
    rulerItem = (new ItemRuler(MFRConfig.rulerItemId.getInt())).setUnlocalizedName("mfr.ruler").setMaxStackSize(1);
    meatIngotRawItem = (new ItemFactoryFood(MFRConfig.meatIngotRawItemId.getInt(), 4, meatIngotSaturation)).setUnlocalizedName("mfr.meat.ingot.raw");
    meatIngotCookedItem = (new ItemFactoryFood(MFRConfig.meatIngotCookedItemId.getInt(), 10, meatIngotSaturation)).setUnlocalizedName("mfr.meat.ingot.cooked");
    meatNuggetRawItem = (new ItemFactoryFood(MFRConfig.meatNuggetRawItemId.getInt(), 1, meatNuggetSaturation)).setUnlocalizedName("mfr.meat.nugget.raw");
    meatNuggetCookedItem = (new ItemFactoryFood(MFRConfig.meatNuggetCookedItemId.getInt(), 4, meatNuggetSaturation)).setUnlocalizedName("mfr.meat.nugget.cooked");
    pinkSlimeballItem = (new ItemFactory(MFRConfig.pinkSlimeballItemId.getInt())).setUnlocalizedName("mfr.pinkslimeball");
    safariNetJailerItem = (new ItemSafariNet(MFRConfig.safariNetJailerItemId.getInt())).setUnlocalizedName("mfr.safarinet.jailer");
    laserFocusItem = (new ItemLaserFocus(MFRConfig.laserFocusItemId.getInt())).setUnlocalizedName("mfr.laserfocus").setMaxStackSize(1);
    needlegunItem = (new ItemNeedleGun(MFRConfig.needlegunItemId.getInt())).setUnlocalizedName("mfr.needlegun").setMaxStackSize(1);
    needlegunAmmoEmptyItem = (new ItemFactory(MFRConfig.needlegunAmmoEmptyItemId.getInt())).setUnlocalizedName("mfr.needlegun.ammo.empty");
    needlegunAmmoStandardItem = (new ItemNeedlegunAmmoStandard(MFRConfig.needlegunAmmoStandardItemId.getInt())).setUnlocalizedName("mfr.needlegun.ammo.standard");
    needlegunAmmoLavaItem = (new ItemNeedlegunAmmoBlock(MFRConfig.needlegunAmmoLavaItemId.getInt(), Block.lavaMoving.blockID, 3)).setUnlocalizedName("mfr.needlegun.ammo.lava");
    needlegunAmmoSludgeItem = (new ItemNeedlegunAmmoBlock(MFRConfig.needlegunAmmoSludgeItemId.getInt(), sludgeLiquid.blockID, 6)).setUnlocalizedName("mfr.needlegun.ammo.sludge");
    needlegunAmmoSewageItem = (new ItemNeedlegunAmmoBlock(MFRConfig.needlegunAmmoSewageItemId.getInt(), sewageLiquid.blockID, 6)).setUnlocalizedName("mfr.needlegun.ammo.sewage");
    needlegunAmmoFireItem = (new ItemNeedlegunAmmoFire(MFRConfig.needlegunAmmoFireItemId.getInt())).setUnlocalizedName("mfr.needlegun.ammo.fire");
    needlegunAmmoAnvilItem = (new ItemNeedlegunAmmoBlock(MFRConfig.needlegunAmmoAnvilItemId.getInt(), Block.anvil.blockID, 2)).setUnlocalizedName("mfr.needlegun.ammo.anvil").setMaxDamage(0);
    plasticCup = (ItemFactoryCup) new ItemFactoryCup(MFRConfig.plasticCupItemId.getInt(), 64, 16).setUnlocalizedName("mfr.bucket.plasticcup");
    rocketLauncherItem = (new ItemRocketLauncher(MFRConfig.rocketLauncherItemId.getInt())).setUnlocalizedName("mfr.rocketlauncher").setMaxStackSize(1);
    rocketItem = (new ItemRocket(MFRConfig.rocketItemId.getInt())).setUnlocalizedName("mfr.rocket").setMaxStackSize(16);
    for (Entry<Integer, Block> machine : machineBlocks.entrySet()) {
        GameRegistry.registerBlock(machine.getValue(), ItemBlockFactoryMachine.class, machine.getValue().getUnlocalizedName());
    }
    GameRegistry.registerBlock(conveyorBlock, ItemBlockConveyor.class, conveyorBlock.getUnlocalizedName());
    GameRegistry.registerBlock(factoryGlassBlock, ItemBlockFactoryGlass.class, factoryGlassBlock.getUnlocalizedName());
    GameRegistry.registerBlock(factoryGlassPaneBlock, ItemBlockFactoryGlassPane.class, factoryGlassPaneBlock.getUnlocalizedName());
    GameRegistry.registerBlock(factoryRoadBlock, ItemBlockFactoryRoad.class, factoryRoadBlock.getUnlocalizedName());
    GameRegistry.registerBlock(factoryDecorativeBrickBlock, ItemBlockFactoryDecorativeBrick.class, factoryDecorativeBrickBlock.getUnlocalizedName());
    GameRegistry.registerBlock(factoryDecorativeStoneBlock, ItemBlockDecorativeStone.class, factoryDecorativeStoneBlock.getUnlocalizedName());
    GameRegistry.registerBlock(rubberWoodBlock, rubberWoodBlock.getUnlocalizedName());
    GameRegistry.registerBlock(rubberLeavesBlock, rubberLeavesBlock.getUnlocalizedName());
    GameRegistry.registerBlock(rubberSaplingBlock, rubberSaplingBlock.getUnlocalizedName());
    GameRegistry.registerBlock(railPickupCargoBlock, railPickupCargoBlock.getUnlocalizedName());
    GameRegistry.registerBlock(railDropoffCargoBlock, railDropoffCargoBlock.getUnlocalizedName());
    GameRegistry.registerBlock(railPickupPassengerBlock, railPickupPassengerBlock.getUnlocalizedName());
    GameRegistry.registerBlock(railDropoffPassengerBlock, railDropoffPassengerBlock.getUnlocalizedName());
    GameRegistry.registerBlock(rednetCableBlock, rednetCableBlock.getUnlocalizedName());
    GameRegistry.registerBlock(rednetLogicBlock, ItemBlockRedNetLogic.class, rednetLogicBlock.getUnlocalizedName());
    GameRegistry.registerBlock(rednetPanelBlock, ItemBlockRedNetPanel.class, rednetPanelBlock.getUnlocalizedName());
    GameRegistry.registerBlock(vineScaffoldBlock, ItemBlockVineScaffold.class, vineScaffoldBlock.getUnlocalizedName());
    GameRegistry.registerBlock(milkLiquid, milkLiquid.getUnlocalizedName());
    GameRegistry.registerBlock(sludgeLiquid, sludgeLiquid.getUnlocalizedName());
    GameRegistry.registerBlock(sewageLiquid, sewageLiquid.getUnlocalizedName());
    GameRegistry.registerBlock(essenceLiquid, essenceLiquid.getUnlocalizedName());
    GameRegistry.registerBlock(biofuelLiquid, biofuelLiquid.getUnlocalizedName());
    GameRegistry.registerBlock(meatLiquid, meatLiquid.getUnlocalizedName());
    GameRegistry.registerBlock(pinkSlimeLiquid, pinkSlimeLiquid.getUnlocalizedName());
    GameRegistry.registerBlock(chocolateMilkLiquid, chocolateMilkLiquid.getUnlocalizedName());
    GameRegistry.registerBlock(mushroomSoupLiquid, mushroomSoupLiquid.getUnlocalizedName());
    Block.setBurnProperties(rubberWoodBlock.blockID, 4, 20);
    Block.setBurnProperties(rubberLeavesBlock.blockID, 30, 20);
    MinecraftForge.setBlockHarvestLevel(MineFactoryReloadedCore.rednetCableBlock, 0, "pickaxe", 0);
    if (MFRConfig.vanillaOverrideGlassPane.getBoolean(true)) {
        Block.blocksList[Block.thinGlass.blockID] = null;
        Item.itemsList[Block.thinGlass.blockID] = null;
        Block.thinGlass = new BlockVanillaGlassPane();
        GameRegistry.registerBlock(Block.thinGlass, Block.thinGlass.getUnlocalizedName());
    }
    if (MFRConfig.vanillaOverrideIce.getBoolean(true)) {
        Block.blocksList[Block.ice.blockID] = null;
        Item.itemsList[Block.ice.blockID] = null;
        Block.ice = new BlockVanillaIce();
        GameRegistry.registerBlock(Block.ice, ItemBlockVanillaIce.class, "blockVanillaIce");
    }
    GameRegistry.registerTileEntity(TileEntityConveyor.class, "factoryConveyor");
    GameRegistry.registerTileEntity(TileEntityRedNetCable.class, "factoryRedstoneCable");
    GameRegistry.registerTileEntity(TileEntityRedNetLogic.class, "factoryRednetLogic");
    GameRegistry.registerTileEntity(TileEntityRedNetHistorian.class, "factoryRednetHistorian");
    EntityRegistry.registerModEntity(EntitySafariNet.class, "entitySafariNet", 0, instance, 160, 5, true);
    EntityRegistry.registerModEntity(EntityPinkSlime.class, "mfrEntityPinkSlime", 1, instance, 160, 5, true);
    EntityRegistry.registerModEntity(EntityNeedle.class, "mfrEntityNeedle", 2, instance, 160, 5, true);
    EntityRegistry.registerModEntity(EntityRocket.class, "mfrEntityRocket", 3, instance, 160, 1, true);
    MinecraftForge.EVENT_BUS.register(instance);
    MinecraftForge.EVENT_BUS.register(proxy);
    OreDictionary.registerOre("itemRubber", MineFactoryReloadedCore.rubberBarItem);
    OreDictionary.registerOre("woodRubber", MineFactoryReloadedCore.rubberWoodBlock);
    OreDictionary.registerOre("sheetPlastic", MineFactoryReloadedCore.plasticSheetItem);
    OreDictionary.registerOre("dustPlastic", MineFactoryReloadedCore.rawPlasticItem);
    OreDictionary.registerOre("ingotMeat", MineFactoryReloadedCore.meatIngotCookedItem);
    OreDictionary.registerOre("ingotMeatRaw", MineFactoryReloadedCore.meatIngotRawItem);
    OreDictionary.registerOre("nuggetMeat", MineFactoryReloadedCore.meatNuggetCookedItem);
    OreDictionary.registerOre("nuggetMeatRaw", MineFactoryReloadedCore.meatNuggetRawItem);
    OreDictionary.registerOre("itemCharcoalSugar", MineFactoryReloadedCore.sugarCharcoalItem);
    OreDictionary.registerOre("cableRedNet", MineFactoryReloadedCore.rednetCableBlock);
    GameRegistry.registerFuelHandler(new MineFactoryReloadedFuelHandler());
    proxy.init();
    NetworkRegistry.instance().registerGuiHandler(this, new MFRGUIHandler());
    IBehaviorDispenseItem behavior = new BehaviorDispenseSafariNet();
    BlockDispenser.dispenseBehaviorRegistry.putObject(safariNetItem, behavior);
    BlockDispenser.dispenseBehaviorRegistry.putObject(safariNetSingleItem, behavior);
    // Work around to make the below behavior actually /exist/ before the server starts.
    DispenserBehaviors.func_96467_a();
    behavior = (IBehaviorDispenseItem) BlockDispenser.dispenseBehaviorRegistry.func_82594_a(Item.bucketWater);
    BlockDispenser.dispenseBehaviorRegistry.putObject(sewageBucketItem, behavior);
    BlockDispenser.dispenseBehaviorRegistry.putObject(sludgeBucketItem, behavior);
    BlockDispenser.dispenseBehaviorRegistry.putObject(mobEssenceBucketItem, behavior);
    BlockDispenser.dispenseBehaviorRegistry.putObject(bioFuelBucketItem, behavior);
    BlockDispenser.dispenseBehaviorRegistry.putObject(meatBucketItem, behavior);
    BlockDispenser.dispenseBehaviorRegistry.putObject(pinkSlimeBucketItem, behavior);
    BlockDispenser.dispenseBehaviorRegistry.putObject(chocolateMilkBucketItem, behavior);
    BlockDispenser.dispenseBehaviorRegistry.putObject(mushroomSoupBucketItem, behavior);
    ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(safariNetSingleItem), 1, 1, 25));
    ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(new WeightedRandomChestContent(new ItemStack(safariNetSingleItem), 1, 1, 25));
    ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(safariNetSingleItem), 1, 1, 25));
    VillagerRegistry.instance().registerVillageCreationHandler(new VillageCreationHandler());
    VillagerRegistry.instance().registerVillagerType(MFRConfig.zoolologistEntityId.getInt(), villagerFolder + "zoologist.png");
    VillagerRegistry.instance().registerVillageTradeHandler(MFRConfig.zoolologistEntityId.getInt(), new VillageTradeHandler());
    GameRegistry.registerWorldGenerator(new MineFactoryReloadedWorldGen());
    TickRegistry.registerScheduledTickHandler(new UpdateManager(this), Side.CLIENT);
}
Also used : BlockRailPassengerPickup(powercrystals.minefactoryreloaded.block.BlockRailPassengerPickup) ItemFactoryCup(powercrystals.minefactoryreloaded.item.ItemFactoryCup) ItemLaserFocus(powercrystals.minefactoryreloaded.item.ItemLaserFocus) ItemRocketLauncher(powercrystals.minefactoryreloaded.item.ItemRocketLauncher) ItemSyringeZombie(powercrystals.minefactoryreloaded.item.ItemSyringeZombie) ItemSyringeSlime(powercrystals.minefactoryreloaded.item.ItemSyringeSlime) BlockFactoryGlassPane(powercrystals.minefactoryreloaded.block.BlockFactoryGlassPane) ItemBlockFactoryGlassPane(powercrystals.minefactoryreloaded.block.ItemBlockFactoryGlassPane) BlockVanillaGlassPane(powercrystals.minefactoryreloaded.block.BlockVanillaGlassPane) VillageTradeHandler(powercrystals.minefactoryreloaded.setup.village.VillageTradeHandler) BlockFakeLaser(powercrystals.minefactoryreloaded.block.BlockFakeLaser) ItemRedNetMemoryCard(powercrystals.minefactoryreloaded.item.ItemRedNetMemoryCard) ItemRuler(powercrystals.minefactoryreloaded.item.ItemRuler) ItemNeedleGun(powercrystals.minefactoryreloaded.item.ItemNeedleGun) ItemSafariNet(powercrystals.minefactoryreloaded.item.ItemSafariNet) ItemStraw(powercrystals.minefactoryreloaded.item.ItemStraw) BlockRailCargoDropoff(powercrystals.minefactoryreloaded.block.BlockRailCargoDropoff) WeightedRandomChestContent(net.minecraft.util.WeightedRandomChestContent) ItemUpgrade(powercrystals.minefactoryreloaded.item.ItemUpgrade) ItemLogicUpgradeCard(powercrystals.minefactoryreloaded.item.ItemLogicUpgradeCard) BlockRubberSapling(powercrystals.minefactoryreloaded.block.BlockRubberSapling) ItemSyringeGrowth(powercrystals.minefactoryreloaded.item.ItemSyringeGrowth) BlockRailCargoPickup(powercrystals.minefactoryreloaded.block.BlockRailCargoPickup) ItemBlockVineScaffold(powercrystals.minefactoryreloaded.block.ItemBlockVineScaffold) BlockVineScaffold(powercrystals.minefactoryreloaded.block.BlockVineScaffold) BlockFactoryMachine(powercrystals.minefactoryreloaded.block.BlockFactoryMachine) ItemBlockFactoryMachine(powercrystals.minefactoryreloaded.block.ItemBlockFactoryMachine) BlockVanillaIce(powercrystals.minefactoryreloaded.block.BlockVanillaIce) ItemBlockVanillaIce(powercrystals.minefactoryreloaded.block.ItemBlockVanillaIce) ItemNeedlegunAmmoFire(powercrystals.minefactoryreloaded.item.ItemNeedlegunAmmoFire) ItemSyringeHealth(powercrystals.minefactoryreloaded.item.ItemSyringeHealth) Block(net.minecraft.block.Block) ItemNeedlegunAmmoBlock(powercrystals.minefactoryreloaded.item.ItemNeedlegunAmmoBlock) UpdateManager(powercrystals.core.updater.UpdateManager) ItemSafariNetLauncher(powercrystals.minefactoryreloaded.item.ItemSafariNetLauncher) BlockRedNetLogic(powercrystals.minefactoryreloaded.block.BlockRedNetLogic) ItemBlockRedNetLogic(powercrystals.minefactoryreloaded.block.ItemBlockRedNetLogic) ItemMilkBottle(powercrystals.minefactoryreloaded.item.ItemMilkBottle) ItemStack(net.minecraft.item.ItemStack) ItemFactoryFood(powercrystals.minefactoryreloaded.item.ItemFactoryFood) ItemRedNetMeter(powercrystals.minefactoryreloaded.item.ItemRedNetMeter) MFRGUIHandler(powercrystals.minefactoryreloaded.gui.MFRGUIHandler) ItemNeedlegunAmmoBlock(powercrystals.minefactoryreloaded.item.ItemNeedlegunAmmoBlock) ItemCeramicDye(powercrystals.minefactoryreloaded.item.ItemCeramicDye) ItemPortaSpawner(powercrystals.minefactoryreloaded.item.ItemPortaSpawner) BlockDecorativeStone(powercrystals.minefactoryreloaded.block.BlockDecorativeStone) ItemBlockDecorativeStone(powercrystals.minefactoryreloaded.block.ItemBlockDecorativeStone) BehaviorDispenseSafariNet(powercrystals.minefactoryreloaded.setup.BehaviorDispenseSafariNet) BlockConveyor(powercrystals.minefactoryreloaded.block.BlockConveyor) ItemBlockConveyor(powercrystals.minefactoryreloaded.block.ItemBlockConveyor) ItemFactory(powercrystals.minefactoryreloaded.item.ItemFactory) ItemSyringeCure(powercrystals.minefactoryreloaded.item.ItemSyringeCure) ItemBlockFactoryRoad(powercrystals.minefactoryreloaded.block.ItemBlockFactoryRoad) BlockFactoryRoad(powercrystals.minefactoryreloaded.block.BlockFactoryRoad) BlockFactoryDecorativeBricks(powercrystals.minefactoryreloaded.block.BlockFactoryDecorativeBricks) ItemBlockRedNetPanel(powercrystals.minefactoryreloaded.block.ItemBlockRedNetPanel) BlockRedNetPanel(powercrystals.minefactoryreloaded.block.BlockRedNetPanel) BlockRedNetCable(powercrystals.minefactoryreloaded.block.BlockRedNetCable) ItemXpExtractor(powercrystals.minefactoryreloaded.item.ItemXpExtractor) VillageCreationHandler(powercrystals.minefactoryreloaded.setup.village.VillageCreationHandler) IBehaviorDispenseItem(net.minecraft.dispenser.IBehaviorDispenseItem) BlockRailPassengerDropoff(powercrystals.minefactoryreloaded.block.BlockRailPassengerDropoff) MineFactoryReloadedWorldGen(powercrystals.minefactoryreloaded.setup.MineFactoryReloadedWorldGen) ItemSpyglass(powercrystals.minefactoryreloaded.item.ItemSpyglass) MineFactoryReloadedFuelHandler(powercrystals.minefactoryreloaded.setup.MineFactoryReloadedFuelHandler) BlockRubberWood(powercrystals.minefactoryreloaded.block.BlockRubberWood) ItemRocket(powercrystals.minefactoryreloaded.item.ItemRocket) ItemFactoryHammer(powercrystals.minefactoryreloaded.item.ItemFactoryHammer) ItemNeedlegunAmmoStandard(powercrystals.minefactoryreloaded.item.ItemNeedlegunAmmoStandard) BlockFactoryGlass(powercrystals.minefactoryreloaded.block.BlockFactoryGlass) ItemBlockFactoryGlass(powercrystals.minefactoryreloaded.block.ItemBlockFactoryGlass) BlockRubberLeaves(powercrystals.minefactoryreloaded.block.BlockRubberLeaves) PreInit(cpw.mods.fml.common.Mod.PreInit) Init(cpw.mods.fml.common.Mod.Init) PostInit(cpw.mods.fml.common.Mod.PostInit)

Example 3 with Init

use of cpw.mods.fml.common.Mod.Init in project MineFactoryReloaded by powercrystals.

the class TwilightForest method load.

@SuppressWarnings("rawtypes")
@Init
public static void load(FMLInitializationEvent e) {
    if (!Loader.isModLoaded("TwilightForest")) {
        FMLLog.warning("Twilight Forest missing - MFR Twilight Forest Compat not loading");
        return;
    }
    try {
        entityEggs = (HashMap) Class.forName("twilightforest.entity.TFCreatures").getField("entityEggs").get(null);
        twilightForestContainer = FMLCommonHandler.instance().findContainerFor(Class.forName("twilightforest.TwilightForestMod").getField("instance").get(null));
        Class tfBighorn = Class.forName("twilightforest.entity.passive.EntityTFBighorn");
        Class tfBoar = Class.forName("twilightforest.entity.passive.EntityTFBoar");
        Class tfDeer = Class.forName("twilightforest.entity.passive.EntityTFDeer");
        Class tfHydra = Class.forName("twilightforest.entity.EntityTFHydra");
        Class tfHydraHead = Class.forName("twilightforest.entity.EntityTFHydraHead");
        Class tfHydraNeck = Class.forName("twilightforest.entity.EntityTFHydraNeck");
        Class tfHydraPart = Class.forName("twilightforest.entity.EntityTFHydraPart");
        Class tfKingSpider = Class.forName("twilightforest.entity.EntityTFKingSpider");
        Class tfLich = Class.forName("twilightforest.entity.EntityTFLich");
        Class tfNaga = Class.forName("twilightforest.entity.EntityTFNaga");
        Class tfNagaSegment = Class.forName("twilightforest.entity.EntityTFNagaSegment");
        Class tfQuestRam = Class.forName("twilightforest.entity.passive.EntityTFQuestRam");
        Class tfUrGhast = Class.forName("twilightforest.entity.EntityTFUrGhast");
        MFRRegistry.registerSafariNetBlacklist(tfHydra);
        MFRRegistry.registerSafariNetBlacklist(tfHydraHead);
        MFRRegistry.registerSafariNetBlacklist(tfHydraNeck);
        MFRRegistry.registerSafariNetBlacklist(tfHydraPart);
        MFRRegistry.registerSafariNetBlacklist(tfKingSpider);
        MFRRegistry.registerSafariNetBlacklist(tfLich);
        MFRRegistry.registerSafariNetBlacklist(tfNaga);
        MFRRegistry.registerSafariNetBlacklist(tfNagaSegment);
        MFRRegistry.registerSafariNetBlacklist(tfQuestRam);
        MFRRegistry.registerSafariNetBlacklist(tfUrGhast);
        MFRRegistry.registerGrinderBlacklist(tfUrGhast);
        MFRRegistry.registerGrinderBlacklist(tfNagaSegment);
        MFRRegistry.registerGrinderBlacklist(tfNaga);
        MFRRegistry.registerGrinderBlacklist(tfLich);
        MFRRegistry.registerGrinderBlacklist(tfHydraPart);
        MFRRegistry.registerGrinderBlacklist(tfHydraNeck);
        MFRRegistry.registerGrinderBlacklist(tfHydraHead);
        MFRRegistry.registerGrinderBlacklist(tfHydra);
        MFRRegistry.registerMobEggHandler(new TwilightForestEggHandler());
        MFRRegistry.registerBreederFood(tfBighorn, new ItemStack(Item.wheat));
        MFRRegistry.registerBreederFood(tfBoar, new ItemStack(Item.carrot));
        MFRRegistry.registerBreederFood(tfDeer, new ItemStack(Item.wheat));
        MFRRegistry.registerRanchable(new RanchableTFBighorn(tfBighorn));
        Class tfBlocks = Class.forName("twilightforest.block.TFBlocks");
        if (tfBlocks != null) {
            MFRRegistry.registerHarvestable(new HarvestableStandard(((Block) tfBlocks.getField("log").get(null)).blockID, HarvestType.Tree));
            MFRRegistry.registerHarvestable(new HarvestableStandard(((Block) tfBlocks.getField("magicLog").get(null)).blockID, HarvestType.Tree));
            MFRRegistry.registerHarvestable(new HarvestableStandard(((Block) tfBlocks.getField("magicLogSpecial").get(null)).blockID, HarvestType.Tree));
            MFRRegistry.registerHarvestable(new HarvestableStandard(((Block) tfBlocks.getField("root").get(null)).blockID, HarvestType.Tree));
            MFRRegistry.registerHarvestable(new HarvestableTreeLeaves(((Block) tfBlocks.getField("leaves").get(null)).blockID));
            MFRRegistry.registerHarvestable(new HarvestableTreeLeaves(((Block) tfBlocks.getField("magicLeaves").get(null)).blockID));
            MFRRegistry.registerHarvestable(new HarvestableTreeLeaves(((Block) tfBlocks.getField("hedge").get(null)).blockID));
            MFRRegistry.registerHarvestable(new HarvestableTreeLeaves(((Block) tfBlocks.getField("firefly").get(null)).blockID));
            MFRRegistry.registerHarvestable(new HarvestableTreeLeaves(((Block) tfBlocks.getField("cicada").get(null)).blockID));
            MFRRegistry.registerHarvestable(new HarvestableStandard(((Block) tfBlocks.getField("plant").get(null)).blockID, HarvestType.Normal));
            MFRRegistry.registerPlantable(new PlantableStandard(((Block) tfBlocks.getField("sapling").get(null)).blockID, ((Block) tfBlocks.getField("sapling").get(null)).blockID));
            MFRRegistry.registerFertilizable(new FertilizableSapling(((Block) tfBlocks.getField("sapling").get(null)).blockID));
        }
        MFRRegistry.registerRandomMobProvider(new TwilightForestMobProvider());
    } catch (Exception x) {
        x.printStackTrace();
    }
}
Also used : FertilizableSapling(powercrystals.minefactoryreloaded.farmables.fertilizables.FertilizableSapling) HarvestableStandard(powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableStandard) Block(net.minecraft.block.Block) HarvestableTreeLeaves(powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableTreeLeaves) ItemStack(net.minecraft.item.ItemStack) PlantableStandard(powercrystals.minefactoryreloaded.farmables.plantables.PlantableStandard) Init(cpw.mods.fml.common.Mod.Init)

Example 4 with Init

use of cpw.mods.fml.common.Mod.Init in project MineFactoryReloaded by powercrystals.

the class Pam method load.

@Init
public static void load(FMLInitializationEvent e) {
    if (!Loader.isModLoaded("PamHarvestCraft")) {
        FMLLog.warning("Pam's HC base missing - MFR Pam HC Compat not loading");
    } else {
        // Bushes
        registerBush("Blackberry", true, true);
        registerBush("Blueberry", true, true);
        registerBush("Grape", true, true);
        registerBush("Kiwi", true, true);
        registerBush("Raspberry", true, true);
        registerBush("Spiceleaf", true, true);
        registerBush("Strawberry", true, true);
        registerBush("Sunflower", false, true);
        // Crops
        registerCrop("Asparagus", false, false);
        registerCrop("Bean", false, false);
        registerCrop("Beet", false, false);
        registerCrop("Bellpepper", true, false);
        registerCrop("Broccoli", false, false);
        registerCrop("Cantaloupe", true, false);
        registerCrop("Celery", false, false);
        registerCrop("Chilipepper", true, false);
        registerCrop("Coffee", true, false);
        registerCrop("Corn", true, false);
        registerCrop("Cucumber", true, false);
        registerCrop("Eggplant", true, false);
        registerCrop("Garlic", false, false);
        registerCrop("Ginger", false, false);
        registerCrop("Lettuce", false, false);
        registerCrop("Mustard", true, false);
        registerCrop("Onion", false, false);
        registerCrop("Peanut", false, false);
        registerCrop("Peas", true, false);
        registerCrop("Pineapple", false, false);
        registerCrop("Radish", false, false);
        registerCrop("Sweetpotato", false, false);
        registerCrop("Tea", false, false);
        registerCrop("Tomato", true, false);
        registerCrop("Turnip", false, false);
        registerCrop("Zucchini", true, false);
        // misc types
        registerPamMod("Candle", "Candleberry", Category.MISC, true, true, Block.tilledField.blockID);
        registerMisc("Cotton", true, true);
        // plants that require different base soils
        registerPamMod("Rice", "Rice", Category.CROP, false, false, Block.waterStill.blockID);
        registerPamMod("Cranberry", "Cranberry", Category.BUSH, false, true, Block.waterStill.blockID);
        registerPamMod("Whitemushroom", "Whitemushroom", Category.BUSH, false, true, Block.wood.blockID);
        registerPamMod("Rotten", "Rotten", Category.CROP, false, false, Block.slowSand.blockID);
        registerPamMod("Cactusfruit", "Cactusfruit", Category.BUSH, true, true, Block.sand.blockID);
        // fruits
        registerFruit("Apple");
        registerFruit("Avocado");
        registerFruit("Banana");
        registerFruit("Cherry");
        registerFruit("Coconut");
        registerFruit("Lemon");
        registerFruit("Lime");
        registerFruit("Mango");
        registerFruit("Nutmeg");
        registerFruit("Olive");
        registerFruit("Orange");
        registerFruit("Papaya");
        registerFruit("Peach");
        registerFruit("Pear");
        registerFruit("Peppercorn");
        registerFruit("Plum");
        registerFruit("Pomegranate");
        registerFruit("Starfruit");
        registerFruit("Vanillabean");
        registerFruit("Walnut");
        // special case for candle and cinnamon
        registerCandle();
        registerCinnamon();
        try {
            Class<?> mod = Class.forName("mods.PamHarvestCraft.PamHarvestCraft");
            MFRRegistry.registerSludgeDrop(25, new ItemStack((Item) mod.getField("saltItem").get(null)));
        } catch (Exception x) {
            x.printStackTrace();
        }
    }
    if (!Loader.isModLoaded("PamWeeeFlowers")) {
        FMLLog.warning("Pam's Weee! Flowers missing - MFR Pam Weee! Flowers Compat not loading");
    } else {
        String[] flowers = { "White", "Orange", "Magenta", "LightBlue", "Yellow", "Lime", "Pink", "LightGrey", "DarkGrey", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black" };
        try {
            Class<?> mod = Class.forName("mods.PamWeeeFlowers.PamWeeeFlowers");
            MFRRegistry.registerHarvestable(new HarvestableStandard(((Block) mod.getField("pamFlower").get(null)).blockID, HarvestType.Normal));
            for (String flower : flowers) {
                int seedId = ((Item) mod.getField(flower.toLowerCase() + "flowerseedItem").get(null)).itemID;
                int blockId = ((Block) mod.getField("pam" + flower.toLowerCase() + "flowerCrop").get(null)).blockID;
                Method fertilize = Class.forName("mods.PamWeeeFlowers.BlockPamFlowerCrop").getMethod("fertilize", World.class, int.class, int.class, int.class);
                MFRRegistry.registerPlantable(new PlantableCropPlant(seedId, blockId));
                MFRRegistry.registerHarvestable(new HarvestablePams(blockId));
                MFRRegistry.registerFertilizable(new FertilizableCropReflection(blockId, fertilize, 7));
            }
        } catch (ClassNotFoundException x) {
            FMLLog.warning("Unable to load Pam support for Weee! Flowers even though Weee! FLowers was present");
        } catch (Exception x) {
            x.printStackTrace();
        }
    }
}
Also used : Method(java.lang.reflect.Method) Item(net.minecraft.item.Item) HarvestableStandard(powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableStandard) FertilizableCropReflection(powercrystals.minefactoryreloaded.modhelpers.FertilizableCropReflection) PlantableCropPlant(powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack) Init(cpw.mods.fml.common.Mod.Init)

Example 5 with Init

use of cpw.mods.fml.common.Mod.Init in project MineFactoryReloaded by powercrystals.

the class Railcraft method load.

@Init
public void load(FMLInitializationEvent evt) {
    if (!Loader.isModLoaded("Railcraft")) {
        FMLLog.warning("Railcraft missing - MFR Railcraft Compat not loading");
        // why warn?
        return;
    }
    try {
        int id = MineFactoryReloadedCore.factoryDecorativeStoneBlock.blockID;
        FMLInterModComms.sendMessage("Railcraft", "balast", String.format("%s@%s", id, 8));
        FMLInterModComms.sendMessage("Railcraft", "balast", String.format("%s@%s", id, 9));
        // white sand? black sand?
        Object rockCrusher = Class.forName("mods.railcraft.api.crafting.RailcraftCraftingManager").getField("rockCrusher").get(null);
        Method createNewRecipe = Class.forName("mods.railcraft.api.crafting.IRockCrusherCraftingManager").getMethod("createNewRecipe", ItemStack.class, boolean.class, boolean.class);
        Method addOutput = Class.forName("mods.railcraft.api.crafting.IRockCrusherRecipe").getMethod("addOutput", ItemStack.class, float.class);
        Object recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 10), true, false);
        // Paved Blackstone -> Cobble 
        addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 2), 1.0f);
        recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 11), true, false);
        // Paved Whitestone -> Cobble
        addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 3), 1.0f);
        recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 0), true, false);
        // Smooth Blackstone -> Cobble 
        addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 2), 1.0f);
        recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 1), true, false);
        // Smooth Whitestone -> Cobble
        addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 3), 1.0f);
        recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 2), true, false);
        // Cobble Blackstone -> Gravel + flint
        addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 8), 1.0f);
        addOutput.invoke(recipe, new ItemStack(Item.flint, 1, 0), 0.05f);
        recipe = createNewRecipe.invoke(rockCrusher, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 3), true, false);
        // Cobble Whitestone -> Gravel + flint
        addOutput.invoke(recipe, new ItemStack(MineFactoryReloadedCore.factoryDecorativeStoneBlock, 1, 9), 1.0f);
        addOutput.invoke(recipe, new ItemStack(Item.flint, 1, 0), 0.05f);
    } catch (Throwable _) {
        ModContainer This = FMLCommonHandler.instance().findContainerFor(this);
        FMLLog.log(This.getModId(), Level.SEVERE, "There was a problem loading %s.", This.getName());
        _.printStackTrace();
    }
}
Also used : ModContainer(cpw.mods.fml.common.ModContainer) Method(java.lang.reflect.Method) ItemStack(net.minecraft.item.ItemStack) Init(cpw.mods.fml.common.Mod.Init)

Aggregations

Init (cpw.mods.fml.common.Mod.Init)16 ItemStack (net.minecraft.item.ItemStack)10 Block (net.minecraft.block.Block)8 Method (java.lang.reflect.Method)7 HarvestableStandard (powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableStandard)7 Item (net.minecraft.item.Item)6 HarvestableTreeLeaves (powercrystals.minefactoryreloaded.farmables.harvestables.HarvestableTreeLeaves)6 PlantableStandard (powercrystals.minefactoryreloaded.farmables.plantables.PlantableStandard)6 PlantableCropPlant (powercrystals.minefactoryreloaded.farmables.plantables.PlantableCropPlant)5 PostInit (cpw.mods.fml.common.Mod.PostInit)2 FertilizerStandard (powercrystals.minefactoryreloaded.farmables.fertilizables.FertilizerStandard)2 FertilizableCropReflection (powercrystals.minefactoryreloaded.modhelpers.FertilizableCropReflection)2 PreInit (cpw.mods.fml.common.Mod.PreInit)1 ModContainer (cpw.mods.fml.common.ModContainer)1 Field (java.lang.reflect.Field)1 IBehaviorDispenseItem (net.minecraft.dispenser.IBehaviorDispenseItem)1 EntitySlime (net.minecraft.entity.monster.EntitySlime)1 EntityChicken (net.minecraft.entity.passive.EntityChicken)1 EntityOcelot (net.minecraft.entity.passive.EntityOcelot)1 EntityWolf (net.minecraft.entity.passive.EntityWolf)1