cpw.mods.fml.common.registry.GameRegistry Java Examples

The following examples show how to use cpw.mods.fml.common.registry.GameRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MyTown.java    From MyTown2 with The Unlicense 6 votes vote down vote up
/**
 * Checks the config to see if there are any wrong values.
 * Throws an exception if there is a problem.
 */
private void checkConfig() {
    // Checking cost item
    if(EconomyProxy.isItemEconomy()) {
        String[] split = Config.instance.costItemName.get().split(":");
        if (split.length < 2 || split.length > 3) {
            throw new ConfigException("Field costItem has an invalid value. Template: (modid):(unique_name)[:meta]. Use \"minecraft\" as modid for vanilla items/blocks.");
        }

        if (GameRegistry.findItem(split[0], split[1]) == null) {
            throw new ConfigException("Field costItem has an invalid modid or unique name of the item. Template: (modid):(unique_name)[:meta]. Use \"minecraft\" as modid for vanilla items/blocks.");
        }

        if (split.length > 2 && (!StringUtils.tryParseInt(split[2]) || Integer.parseInt(split[2]) < 0)) {
            throw new ConfigException("Field costItem has an invalid metadata. Template: (modid):(unique_name)[:meta]. Use \"minecraft\" as modid for vanilla items/blocks.");
        }
    }
}
 
Example #2
Source File: AdvancedMod.java    From AdvancedMod with GNU General Public License v3.0 6 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event){
    ModBlocks.init();
    ModTileEntities.init();
    proxy.preInit();
    GameRegistry.registerWorldGenerator(new WorldGeneratorFlag(), 0);
    NetworkHandler.init();
    DescriptionHandler.init();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
    MinecraftForge.EVENT_BUS.register(new AdvancedModEventHandler());//For registering events from the net.miencraftforge.event package.
    FMLCommonHandler.instance().bus().register(new AdvancedModEventHandler());//For registering events from the cpw.mods.fml.gameevent package.
    FMLInterModComms.sendMessage(Reference.MOD_ID, "camoMineBlacklist", new ItemStack(Blocks.stone));
    FMLInterModComms.sendMessage("Waila", "register", "com.minemaarten.advancedmod.thirdparty.waila.Waila.onWailaCall");
    Log.info("Pre Initialization Complete!");

    if(Loader.isModLoaded("Thaumcraft")) {
        loadThaumcraft();
    }
}
 
Example #3
Source File: ModBlocks.java    From GardenCollection with MIT License 6 votes vote down vote up
public void init () {
    gardenSoil = new BlockGardenSoil(makeName("gardenSoil"));
    gardenFarmland = new BlockGardenFarmland(makeName("gardenFarmland"));
    gardenProxy = new BlockGardenProxy(makeName("gardenProxy"));
    smallFire = new BlockSmallFire(makeName("smallFire"));
    compostBin = new BlockCompostBin(makeName("compostBin"));

    GameRegistry.registerBlock(gardenSoil, "garden_soil");
    GameRegistry.registerBlock(gardenFarmland, "garden_farmland");
    GameRegistry.registerBlock(gardenProxy, "garden_proxy");
    GameRegistry.registerBlock(smallFire, "small_fire");
    GameRegistry.registerBlock(compostBin, "compost_bin");

    GameRegistry.registerTileEntity(TileEntityGardenSoil.class, ModBlocks.getQualifiedName(gardenSoil));
    GameRegistry.registerTileEntity(TileEntityGardenFarmland.class, ModBlocks.getQualifiedName(gardenFarmland));
    GameRegistry.registerTileEntity(TileEntityCompostBin.class, ModBlocks.getQualifiedName(compostBin));
}
 
Example #4
Source File: BlockConverter.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void registerNovaBlock(BlockFactory blockFactory) {
	FWBlock blockWrapper = new FWBlock(blockFactory);
	blockFactoryMap.put(blockFactory, blockWrapper);
	NovaMinecraft.proxy.registerBlock(blockWrapper);
	String blockId = blockFactory.getID();
	if (!blockId.contains(":"))
		blockId = NovaLauncher.instance().flatMap(NovaLauncher::getCurrentMod).map(Mod::id).orElse("nova") + ':' + blockId;
	GameRegistry.registerBlock(blockWrapper, FWItemBlock.class, blockId);

	if (blockWrapper.dummy.components.has(Category.class) && FMLCommonHandler.instance().getSide().isClient()) {
		//Add into creative tab
		Category category = blockWrapper.dummy.components.get(Category.class);
		blockWrapper.setCreativeTab(CategoryConverter.instance().toNative(category, blockWrapper));
	}

	Game.logger().info("Registered block: {}", blockFactory.getID());
}
 
Example #5
Source File: DefaultApiHandler.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean registerAdditionalGolemType(String name, String modId, AdditionalGolemType newType) {
    String uniqueName = name.toUpperCase();
    if(!additionalGolemTypes.containsKey(uniqueName)) {
        GolemEnumHelper.addGolemType(uniqueName, newType);

        ItemAdditionalGolemPlacer placerItem = new ItemAdditionalGolemPlacer(newType);
        GameRegistry.registerItem(placerItem, "item" + StringHelper.firstToUpper(name.toLowerCase()) + "GolemPlacer");
        newType.setModId(modId);
        newType.setPlacerItem(placerItem);

        additionalGolemTypes.put(uniqueName, newType);
        return true;
    }
    return false;
}
 
Example #6
Source File: TwilightForestIntegration.java    From GardenCollection with MIT License 6 votes vote down vote up
public static void init () {
    if (!Loader.isModLoaded(MOD_ID))
        return;

    try {
        classEntityFirefly = Class.forName("twilightforest.entity.passive.EntityTFTinyFirefly");
        classRenderFirefly = Class.forName("twilightforest.client.renderer.entity.RenderTFTinyFirefly");

        constEntityFirefly = classEntityFirefly.getConstructor(World.class, double.class, double.class, double.class);
        constRenderFirefly = classRenderFirefly.getConstructor();

        if (GardenStuff.proxy instanceof ClientProxy)
            registerEntity();

        Block blockFirefly = GameRegistry.findBlock(MOD_ID, "tile.TFFirefly");
        ILanternSource fireflySource = new FireflyLanternSource(blockFirefly);

        GardenAPI.instance().registries().lanternSources().registerLanternSource(fireflySource);

        initialized = true;
    }
    catch (Throwable t) { }
}
 
Example #7
Source File: ModBlocks.java    From GardenCollection with MIT License 6 votes vote down vote up
public void init () {
    thinLog = new BlockThinLog(makeName("thinLog"));
    thinLogFence = new BlockThinLogFence(makeName("thinLogFence"));
    flowerLeaves = new BlockFlowerLeaves(makeName("flowerLeaves"));
    sapling = new BlockGTSapling(makeName("sapling"));
    ivy = new BlockIvy(makeName("ivy"));
    strangePlant = new BlockStrangePlant(makeName("strangePlant"));
    candelilla = new BlockCandelilla(makeName("candelilla"));

    GameRegistry.registerBlock(sapling, ItemGTSapling.class, "sapling");
    GameRegistry.registerBlock(thinLog, ItemThinLog.class, "thin_log");
    GameRegistry.registerBlock(thinLogFence, ItemThinLogFence.class, "thin_log_fence");
    //GameRegistry.registerBlock(flowerLeaves, "flower_leaves");
    GameRegistry.registerBlock(ivy, ItemIvy.class, "ivy");
    GameRegistry.registerBlock(strangePlant, "strange_plant");
    GameRegistry.registerBlock(candelilla, "candelilla_bush");

    GameRegistry.registerTileEntity(TileEntityWoodProxy.class, ModBlocks.getQualifiedName(thinLog));
}
 
Example #8
Source File: EnderStorageProxy.java    From EnderStorage with MIT License 6 votes vote down vote up
public void init()
{
    blockEnderChest = new BlockEnderStorage();
    blockEnderChest.setBlockName("enderchest");
    GameRegistry.registerBlock(blockEnderChest, ItemEnderStorage.class, "enderChest");
    MinecraftForge.EVENT_BUS.register(blockEnderChest);
    
    itemEnderPouch = new ItemEnderPouch();
    itemEnderPouch.setUnlocalizedName("enderpouch");
    GameRegistry.registerItem(itemEnderPouch, "enderPouch");
    
    GameRegistry.registerTileEntity(TileEnderChest.class, "Ender Chest");
    GameRegistry.registerTileEntity(TileEnderTank.class, "Ender Tank");
    
    PacketCustom.assignHandler(EnderStorageSPH.channel, new EnderStorageSPH());
    EnderStorageRecipe.init();
}
 
Example #9
Source File: Botania.java    From GardenCollection with MIT License 6 votes vote down vote up
@Override
public boolean applyBonemeal (World world, int x, int y, int z, BlockGarden hostBlock, int slot) {
    TileEntityGarden te = hostBlock.getTileEntity(world, x, y, z);

    Block block = hostBlock.getPlantBlockFromSlot(world, x, y, z, slot);
    int meta = hostBlock.getPlantMetaFromSlot(world, x, y, z, slot);

    Block flower = GameRegistry.findBlock(MOD_ID, "flower");

    if (block == flower) {
        ItemStack upgrade = ((meta & 0x8) == 0) ? new ItemStack(flower1, 1, meta) : new ItemStack(flower2, 1, meta & 0x7);
        if (hostBlock.isPlantValidForSlot(world, x, y, z, slot, PlantItem.getForItem(upgrade))) {
            te.setInventorySlotContents(slot, upgrade);
            return true;
        }
    }

    return false;
}
 
Example #10
Source File: WRLogicProxy.java    From WirelessRedstone with MIT License 6 votes vote down vote up
public void init()
{  
    MultiPartRegistry.registerParts(this, new String[]{
            "wrcbe-tran",
            "wrcbe-recv",
            "wrcbe-jamm"
    });

    MultipartGenerator.registerPassThroughInterface("codechicken.wirelessredstone.core.ITileWireless");
    MultipartGenerator.registerPassThroughInterface("codechicken.wirelessredstone.core.ITileReceiver");
    MultipartGenerator.registerPassThroughInterface("codechicken.wirelessredstone.core.ITileJammer");
    //until CC proper integration
    //MultipartGenerator.registerPassThroughInterface("dan200.computer.api.IPeripheral");
    
    itemwireless = new ItemWirelessPart().setCreativeTab(CreativeTabs.tabRedstone);
    GameRegistry.registerItem(itemwireless, "wirelessLogic");

    addRecipies();
}
 
Example #11
Source File: Chisel.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
@EventHandler
public void init(FMLInitializationEvent event) {
	Features.init();

	NetworkRegistry.INSTANCE.registerGuiHandler(this, new ChiselGuiHandler());

	addWorldgen(Features.MARBLE, ChiselBlocks.marble, Configurations.marbleAmount);
	addWorldgen(Features.LIMESTONE, ChiselBlocks.limestone, Configurations.limestoneAmount);
	addWorldgen(Features.ANDESITE, ChiselBlocks.andesite, Configurations.andesiteAmount, 40, 100, 0.5);
	addWorldgen(Features.GRANITE, ChiselBlocks.granite, Configurations.graniteAmount, 40, 100, 0.5);
	addWorldgen(Features.DIORITE, ChiselBlocks.diorite, Configurations.dioriteAmount, 40, 100, 0.5);
	GameRegistry.registerWorldGenerator(GeneratorChisel.INSTANCE, 1000);

       EntityRegistry.registerModEntity(EntityChiselSnowman.class, "snowman", 0, this, 80, 1, true);

	proxy.init();
	MinecraftForge.EVENT_BUS.register(this);
	FMLCommonHandler.instance().bus().register(instance);

	FMLInterModComms.sendMessage("Waila", "register", "com.cricketcraft.chisel.compat.WailaCompat.register");
}
 
Example #12
Source File: ClientProxy.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init(){
    for(int i = 0; i < 16; i++) { //Only register these recipes client side, so NEI compatibility works, but drones don't lose their program when dyed.
        ItemStack drone = new ItemStack(Itemss.drone);
        NBTTagCompound tag = new NBTTagCompound();
        tag.setInteger("color", ItemDye.field_150922_c[i]);
        drone.setTagCompound(tag);
        GameRegistry.addRecipe(new ShapelessOreRecipe(drone, Itemss.drone, TileEntityPlasticMixer.DYES[i]));
    }
    CraftingRegistrator.addShapelessRecipe(new ItemStack(Itemss.drone), new ItemStack(Itemss.logisticsDrone), Itemss.printedCircuitBoard);

    ThirdPartyManager.instance().clientInit();
}
 
Example #13
Source File: ThaumcraftIntegration.java    From GardenCollection with MIT License 5 votes vote down vote up
private static void initWood () {
    Block log = GameRegistry.findBlock(MOD_ID, "blockMagicalLog");
    Block leaf = GameRegistry.findBlock(MOD_ID, "blockMagicalLeaves");

    Item sapling = Item.getItemFromBlock(GameRegistry.findBlock(MOD_ID, "blockCustomPlant"));

    WoodRegistry woodReg = WoodRegistry.instance();
    woodReg.registerWoodType(log, 0);
    woodReg.registerWoodType(log, 1);

    SaplingRegistry saplingReg = SaplingRegistry.instance();
    saplingReg.registerSapling(sapling, 0, log, 0, leaf, 0); // Greatwood
    saplingReg.registerSapling(sapling, 1, log, 1, leaf, 1); // Silverwood
}
 
Example #14
Source File: CommonProxy.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void RegisterTileEntities()
{
	GameRegistry.registerTileEntity(TileEntitySolderingStation.class, "tileEntitySolderingStation");
	GameRegistry.registerTileEntity(TileEntityMEDropper.class, "tileEntityMEDropper");
	GameRegistry.registerTileEntity(TileEntityMEBattery.class, "tileEntityMEBattery");
	GameRegistry.registerTileEntity(TileEntityHardMEDrive.class, "tileEntityHardMEDrive");
	GameRegistry.registerTileEntity(TileEntityBusFluidImport.class, "tileEntityBusFluidImport");
	GameRegistry.registerTileEntity(TileEntityBusFluidExport.class, "tileEntityBusFluidExport");
	GameRegistry.registerTileEntity(TileEntityBusFluidStorage.class, "tileEntityBusFluidStorage");
	GameRegistry.registerTileEntity(TileEntityTerminalFluid.class, "tileEntityTerminalFluid");
	GameRegistry.registerTileEntity(TileEntityTransitionPlaneFluid.class, "tileEntityTransitionPlaneFluid");
	GameRegistry.registerTileEntity(TileEntityCertusTank.class, "tileEntityCertusTank");
	GameRegistry.registerTileEntity(TileEntityWalrus.class, "tileEntityWalrus");
	GameRegistry.registerTileEntity(TileEntityLevelEmitterFluid.class, "tileEntityLevelEmitterFluid");
	GameRegistry.registerTileEntity(TileEntityVoidFluid.class, "tileEntityVoidFluid");
	GameRegistry.registerTileEntity(TileEntityInterfaceFluid.class, "tileEntityInterfaceFluid");
	GameRegistry.registerTileEntity(TileEntityMonitorStorageFluid.class, "tileEntityMonitorStorageFluid");

	try
	{
		Class.forName("appeng.api.me.util.ITileCraftingProvider");
		GameRegistry.registerTileEntity(TileEntityFluidCrafter.class, "tileEntityFluidCrafter");
	} catch (ClassNotFoundException e)
	{
		// AE13
	}
}
 
Example #15
Source File: ModBlocks.java    From GardenCollection with MIT License 5 votes vote down vote up
public void init () {
    woodWindowBox = new BlockWindowBox(makeName("woodWindowBox"), Material.wood);
    stoneWindowBox = new BlockWindowBoxStone(makeName("stoneWindowBox"));
    decorativePot = new BlockDecorativePot(makeName("decorativePot"));
    largePot = new BlockLargePotStandard(makeName("largePot"));
    largePotColored = new BlockLargePotColored(makeName("largePotColored"));
    mediumPot = new BlockMediumPotStandard(makeName("mediumPot"));
    mediumPotColored = new BlockMediumPotColored(makeName("mediumPotColored"));
    potteryTable = new BlockPotteryTable(makeName("potteryTable"));

    GameRegistry.registerBlock(woodWindowBox, ItemWindowBox.class, "wood_window_box");
    GameRegistry.registerBlock(stoneWindowBox, ItemWindowBox.class, "stone_window_box");
    GameRegistry.registerBlock(decorativePot, ItemDecorativePot.class, "decorative_pot");
    GameRegistry.registerBlock(largePot, ItemLargePot.class, "large_pot");
    GameRegistry.registerBlock(largePotColored, ItemLargePot.class, "large_pot_colored");
    GameRegistry.registerBlock(mediumPot, ItemMediumPot.class, "medium_pot");
    GameRegistry.registerBlock(mediumPotColored, ItemMediumPot.class, "medium_pot_colored");
    GameRegistry.registerBlock(potteryTable, "pottery_table");

    GameRegistry.registerTileEntity(TileEntityWindowBox.class, ModBlocks.getQualifiedName(woodWindowBox));
    GameRegistry.registerTileEntity(TileEntityDecorativePot.class, ModBlocks.getQualifiedName(decorativePot));
    GameRegistry.registerTileEntity(TileEntityLargePot.class, ModBlocks.getQualifiedName(largePot));
    GameRegistry.registerTileEntity(TileEntityLargePot.class, ModBlocks.getQualifiedName(largePotColored));
    GameRegistry.registerTileEntity(TileEntityMediumPot.class, ModBlocks.getQualifiedName(mediumPot));
    GameRegistry.registerTileEntity(TileEntityMediumPot.class, ModBlocks.getQualifiedName(mediumPotColored));
    GameRegistry.registerTileEntity(TileEntityPotteryTable.class, ModBlocks.getQualifiedName(potteryTable));
}
 
Example #16
Source File: BiomesOPlenty.java    From GardenCollection with MIT License 5 votes vote down vote up
@Override
public int getPlantHeight (Block block, int meta) {
    GameRegistry.UniqueIdentifier uid = GameRegistry.findUniqueIdentifierFor(block);
    if (uid.name.equals("foliage")) {
        if (meta == 3)
            return 2;
    }

    return 1;
}
 
Example #17
Source File: IC2.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void preInit(){
    pneumaticGenerator = new BlockPneumaticGenerator(Material.iron).setHardness(3.0F).setResistance(10.0F).setBlockName("pneumaticGenerator");
    electricCompressor = new BlockElectricCompressor(Material.iron).setHardness(3.0F).setResistance(10.0F).setBlockName("electricCompressor");
    Blockss.registerBlock(pneumaticGenerator);
    Blockss.registerBlock(electricCompressor);
    GameRegistry.registerTileEntity(TileEntityPneumaticGenerator.class, "TileEntityPneumaticGenerator");
    GameRegistry.registerTileEntity(TileEntityElectricCompressor.class, "TileEntityElectricCompressor");
    PneumaticRegistry.getInstance().registerBlockTrackEntry(new BlockTrackEntryIC2());
}
 
Example #18
Source File: BlockMarbleStairsMaker.java    From Chisel with GNU General Public License v2.0 5 votes vote down vote up
public void create(BlockMarbleStairsMakerCreator creator, String name)
{
    blocks = new BlockMarbleStairs[carverHelper.variations.size() / 2];
    for(int i = 0; i < blocks.length; i++)
    {
        String n = name + "." + i;
        blocks[i] = creator == null ?
                new BlockMarbleStairs(blockBase, i * 2, carverHelper) :
                creator.create(blockBase, i * 2, carverHelper);

        blocks[i].setBlockName(n);
        GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);

        for(int meta = 0; meta < 2 && i * 2 + meta < carverHelper.variations.size(); meta++)
        {
            CarvableVariation variation = carverHelper.variations.get(i * 2 + meta);

            for(int j = 0; j < 8; j++)
                carverHelper.registerVariation(name + ".orientation." + j, variation, blocks[i], j + meta * 8);

            CraftingManager.getInstance().addRecipe(new ItemStack(blocks[i], 4, meta * 8), new Object[]{"*  ", "** ", "***", '*', new ItemStack(blockBase, 1, i * 2 + meta)});
        }

        CarvableHelper.chiselBlocks.add(blocks[i]);
    }

}
 
Example #19
Source File: Compatibility.java    From Chisel with GNU General Public License v2.0 5 votes vote down vote up
public static void addSupport(String modname, String blockname, String name, int metadata, int order)
{
    if(Loader.isModLoaded(modname) && GameRegistry.findBlock(modname, blockname) != null)
    {
        Carving.chisel.addVariation(name, GameRegistry.findBlock(modname, blockname), metadata, order);
        GameRegistry.findBlock(modname, blockname).setHarvestLevel("chisel", 0, 0);
    }
}
 
Example #20
Source File: BigReactors.java    From BigReactors with MIT License 5 votes vote down vote up
/**
 * Call this to register Tile Entities
 */
public static void registerTileEntities()
{
	if (!registeredTileEntities)
	{
		GameRegistry.registerTileEntity(TileEntityReactorPowerTap.class, 	"BRReactorPowerTap");
		GameRegistry.registerTileEntity(TileEntityReactorPart.class, 		"BRReactorPart");
		GameRegistry.registerTileEntity(TileEntityReactorAccessPort.class,	"BRReactorAccessPort");
		GameRegistry.registerTileEntity(TileEntityReactorGlass.class,		"BRReactorGlass");
		GameRegistry.registerTileEntity(TileEntityReactorFuelRod.class, 			"BRFuelRod");
		GameRegistry.registerTileEntity(TileEntityCyaniteReprocessor.class, "BRCyaniteReprocessor");
		
		GameRegistry.registerTileEntity(TileEntityReactorControlRod.class, "BRReactorControlRod");
		GameRegistry.registerTileEntity(TileEntityReactorRedNetPort.class, "BRReactorRedNetPort");
		GameRegistry.registerTileEntity(TileEntityReactorRedstonePort.class,"BRReactorRedstonePort");
		GameRegistry.registerTileEntity(TileEntityReactorComputerPort.class, "BRReactorComputerPort");
		GameRegistry.registerTileEntity(TileEntityReactorCoolantPort.class, "BRReactorCoolantPort");
		GameRegistry.registerTileEntity(TileEntityReactorCreativeCoolantPort.class, "BRReactorCreativeCoolantPort");

		GameRegistry.registerTileEntity(TileEntityTurbinePartStandard.class,  "BRTurbinePart");
		GameRegistry.registerTileEntity(TileEntityTurbinePowerTap.class, "BRTurbinePowerTap");
		GameRegistry.registerTileEntity(TileEntityTurbineFluidPort.class, "BRTurbineFluidPort");
		GameRegistry.registerTileEntity(TileEntityTurbineComputerPort.class, "BRTurbineComputerPort");
		GameRegistry.registerTileEntity(TileEntityTurbinePartGlass.class,  "BRTurbineGlass");
		GameRegistry.registerTileEntity(TileEntityTurbineRotorBearing.class, "BRTurbineRotorBearing");
		GameRegistry.registerTileEntity(TileEntityTurbineRotorPart.class, "BRTurbineRotorPart");
		GameRegistry.registerTileEntity(TileEntityTurbineCreativeSteamGenerator.class, "BRTurbineCreativeSteamGenerator");

		registeredTileEntities = true;
	}
}
 
Example #21
Source File: Registries.java    From Ex-Aliquo with MIT License 5 votes vote down vote up
public static void postInitHammers() {
	for (AliquoHammer hammer : AliquoHammer.registeredHammers()) {
		AliquoMaterial am = AliquoMaterial.get(hammer.material);
		
		EnumToolMaterial toolEnum = am.getToolEnumFromRecipe();
		if (toolEnum == null)
		{
			toolEnum = am.getFallbackToolEnum();
		}
		
		GameRegistry.addRecipe(new ShapedOreRecipe(hammer, hammershape, 's', "stickWood", 'i', hammer.getIngotName()));
		
		hammer.setToolMaterial(toolEnum);
	}
}
 
Example #22
Source File: BigReactors.java    From BigReactors with MIT License 5 votes vote down vote up
public static void registerFuelRods(int id, boolean require) {
	if(BigReactors.blockYelloriumFuelRod == null) {
		BRConfig.CONFIGURATION.load();
		BigReactors.blockYelloriumFuelRod = new BlockFuelRod(Material.iron);
		GameRegistry.registerBlock(BigReactors.blockYelloriumFuelRod, ItemBlock.class, "YelloriumFuelRod");
		BRConfig.CONFIGURATION.save();
	}
}
 
Example #23
Source File: BaseRecipeRegistry.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
public static void addCarversRecipes() {
    for (int i = 0; i < OreDictionary.getOres("logWood").size(); i++) {
        woodenCarver = GameRegistry.addShapedRecipe(BaseItemStacks.woodenCarver, " X ", "YYY", 'X', Items.flint, 'Y', OreDictionary.getOres("logWood").get(i));
    }
    stoneCarver = GameRegistry.addShapedRecipe(BaseItemStacks.stoneCarver, " X ", "YYY", 'X', Items.flint, 'Y', Blocks.stone);
    ironCarver = GameRegistry.addShapedRecipe(BaseItemStacks.ironCarver, " X ", "YYY", 'X', BaseItemStacks.ironShard, 'Y', Blocks.stone);
    obsidianCarver = GameRegistry.addShapedRecipe(BaseItemStacks.obsidianCarver, " X ", "YYY", 'X', BaseItemStacks.ironShard, 'Y', Blocks.obsidian);
    diamondCarver = GameRegistry.addShapedRecipe(BaseItemStacks.ironCarver, " X ", "YYY", "ZZZ", 'X', BaseItemStacks.obsidianShard, 'Y', Items.diamond, 'Z', Blocks.obsidian);
}
 
Example #24
Source File: BlockSupplier.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param blockName
 * @return
 */
public static Block getBlock(String blockName){
    return GameRegistry.findBlock("PneumaticCraft", blockName);
    /*try {
        if(blockClass == null) blockClass = Class.forName("pneumaticCraft.common.block.Blockss");
        return (Block)blockClass.getField(blockName).get(null);
    } catch(Exception e) {
        System.err.println("[PneumaticCraft API] Block supply failed for block: " + blockName);
        return null;
    }*/
}
 
Example #25
Source File: NaturaIntegration.java    From GardenCollection with MIT License 5 votes vote down vote up
public static void init () {
    if (!Loader.isModLoaded(MOD_ID))
        return;

    Map<String, int[]> saplingBank1 = new HashMap<String, int[]>();
    saplingBank1.put("small_oak", new int[] { 1, 3, 4, 6, 7 });
    saplingBank1.put("large_spruce", new int[] { 0 });
    saplingBank1.put("small_shrub", new int[] { 2 });

    Map<String, int[]> saplingBank2 = new HashMap<String, int[]>();
    saplingBank2.put("small_oak", new int[] { 0, 1, 3 });
    saplingBank2.put("tall_small_oak", new int[] { 2 });
    saplingBank2.put("small_willow", new int[] { 4 });

    Map<Item, Map<String, int[]>> banks = new HashMap<Item, Map<String, int[]>>();
    banks.put(GameRegistry.findItem(MOD_ID, "florasapling"), saplingBank1);
    banks.put(GameRegistry.findItem(MOD_ID, "Rare Sapling"), saplingBank2);

    SaplingRegistry saplingReg = SaplingRegistry.instance();

    for (Map.Entry<Item, Map<String, int[]>> entry : banks.entrySet()) {
        Item sapling = entry.getKey();

        for (Map.Entry<String, int[]> bankEntry : entry.getValue().entrySet()) {
            OrnamentalTreeFactory factory = OrnamentalTreeRegistry.getTree(bankEntry.getKey());
            if (factory == null)
                continue;

            for (int i : bankEntry.getValue()) {
                UniqueMetaIdentifier woodBlock = saplingReg.getWoodForSapling(sapling, i);
                UniqueMetaIdentifier leafBlock = saplingReg.getLeavesForSapling(sapling, i);
                if (woodBlock == null && leafBlock == null)
                    continue;

                saplingReg.putExtendedData(sapling, i, "sm_generator",
                    factory.create(woodBlock.getBlock(), woodBlock.meta, leafBlock.getBlock(), leafBlock.meta));
            }
        }
    }
}
 
Example #26
Source File: IC2TileRegistry.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
public static void registerTEs() {

        GameRegistry.registerTileEntity(TileEntityPotentiaGenerator.class, "tileentitypotentiagenerator");
        GameRegistry.registerTileEntity(TileEntityIgnisGenerator.class, "tileentityignisgenerator");
        GameRegistry.registerTileEntity(TileEntityAuramGenerator.class, "tileentityauramgenerator");
        GameRegistry.registerTileEntity(TileEntityArborGenerator.class, "tileentityarborgenerator");
        GameRegistry.registerTileEntity(TileEntityAerGenerator.class, "tileentityaergenerator");
        GameRegistry.registerTileEntity(TileEntityIndustrialWandRecharge.class, "tileentityindustrialwandrecharge");
        GameRegistry.registerTileEntity(TileEntityCompressedSolar.class, "tileentitycompressedsolar");
        GameRegistry.registerTileEntity(TileEntityDoubleCompressedSolar.class, "tileentitydoublecompressedsolar");
        GameRegistry.registerTileEntity(TileEntityTripleCompressedSolar.class, "tileentitytriplecompressedsolar");
        GameRegistry.registerTileEntity(TileEntityEtherealMacerator.class, "tileentityetherealmacerator");
        GameRegistry.registerTileEntity(TileEntityWaterSolar.class, "tileentitywatersolar");
        GameRegistry.registerTileEntity(TileEntityDoubleWaterSolar.class, "tileentitydoublewatersolar");
        GameRegistry.registerTileEntity(TileEntityTripleWaterSolar.class, "tileentitytriplewatersolar");
        GameRegistry.registerTileEntity(TileEntityDarkSolar.class, "tileentitydarksolar");
        GameRegistry.registerTileEntity(TileEntityDoubleDarkSolar.class, "tileentitydoubledarksolar");
        GameRegistry.registerTileEntity(TileEntityTripleDarkSolar.class, "tileentitytripledarksolar");
        GameRegistry.registerTileEntity(TileEntityOrderSolar.class, "tileentityordersolar");
        GameRegistry.registerTileEntity(TileEntityDoubleOrderSolar.class, "tileentitydoubleordersolar");
        GameRegistry.registerTileEntity(TileEntityTripleOrderSolar.class, "tileentitytripleordersolar");
        GameRegistry.registerTileEntity(TileEntityFireSolar.class, "tileentityfiresolar");
        GameRegistry.registerTileEntity(TileEntityDoubleFireSolar.class, "tileentitydoublefiresolar");
        GameRegistry.registerTileEntity(TileEntityTripleFireSolar.class, "tileentitytriplefiresolar");
        GameRegistry.registerTileEntity(TileEntityAirSolar.class, "tileentityairsolar");
        GameRegistry.registerTileEntity(TileEntityDoubleAirSolar.class, "tileentitydoubleairsolar");
        GameRegistry.registerTileEntity(TileEntityTripleAirSolar.class, "tileentitytripleairsolar");
        GameRegistry.registerTileEntity(TileEntityEarthSolar.class, "tileentityearthsolar");
        GameRegistry.registerTileEntity(TileEntityDoubleEarthSolar.class, "tileentitydoubleearthsolar");
        GameRegistry.registerTileEntity(TileEntityTripleEarthSolar.class, "tileentitytripleearthsolar");
        GameRegistry.registerTileEntity(TileEntityEssentiaGenerator.class, "tileentityessentiagenerator");
    }
 
Example #27
Source File: BaseRecipeRegistry.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
public static IRecipe chainsawTopRecipe(ItemStack output, String X, ItemStack Y) {
    if (isOreRegistered(X)) {
        for (int i = 0; i < OreDictionary.getOres(X).size(); i++) {
            return GameRegistry.addShapedRecipe(output, " Y ", "XYX", "XYX", 'X', OreDictionary.getOres(X).get(i), 'Y', Y);
        }
    }
    return null;
}
 
Example #28
Source File: ModItems.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
private static void registerItem(Item item) {
	if (!(item instanceof IConfigurable) || ((IConfigurable) item).isEnabled()) {
		String name = item.getUnlocalizedName();
		String[] strings = name.split("\\.");
		GameRegistry.registerItem(item, strings[strings.length - 1]);
	}
}
 
Example #29
Source File: PneumaticCraft.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onMissingMapping(FMLMissingMappingsEvent event){
    for(MissingMapping mapping : event.get()) {
        if(mapping.type == GameRegistry.Type.BLOCK && mapping.name.equals("PneumaticCraft:etchingAcid")) {
            mapping.remap(Fluids.etchingAcid.getBlock());
            Log.info("Remapping Etching Acid");
        }
        if(mapping.type == GameRegistry.Type.ITEM && mapping.name.equals("PneumaticCraft:etchingAcidBucket")) {
            mapping.remap(Fluids.getBucket(Fluids.etchingAcid));
            Log.info("Remapping Etching Acid Bucket");
        }

    }
}
 
Example #30
Source File: BlockSupplier.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param blockName
 * @return
 */
public static Block getBlock(String blockName){
    return GameRegistry.findBlock("PneumaticCraft", blockName);
    /*try {
        if(blockClass == null) blockClass = Class.forName("pneumaticCraft.common.block.Blockss");
        return (Block)blockClass.getField(blockName).get(null);
    } catch(Exception e) {
        System.err.println("[PneumaticCraft API] Block supply failed for block: " + blockName);
        return null;
    }*/
}