Java Code Examples for cpw.mods.fml.common.registry.GameRegistry#findBlock()

The following examples show how to use cpw.mods.fml.common.registry.GameRegistry#findBlock() . 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: 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 2
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 3
Source File: ThaumcraftIntegration.java    From GardenCollection with MIT License 5 votes vote down vote up
public static void init () {
    if (!Loader.isModLoaded(MOD_ID))
        return;

    Block blockCandle = GameRegistry.findBlock(ThaumcraftIntegration.MOD_ID, "blockCandle");
    ILanternSource candleSource = new ThaumcraftCandleSource(blockCandle);

    GardenAPI.instance().registries().lanternSources().registerLanternSource(candleSource);
}
 
Example 4
Source File: BCItems.java    From SimplyJetpacks with MIT License 5 votes vote down vote up
public static void init() {
    SimplyJetpacks.logger.info("Stealing BuildCraft's items");
    
    if (Loader.isModLoaded("BuildCraft|Transport")) {
        pipeFluidStone = new ItemStack(GameRegistry.findItem("BuildCraft|Transport", "item.buildcraftPipe.pipefluidsstone"));
        pipeEnergyGold = new ItemStack(GameRegistry.findItem("BuildCraft|Transport", "item.buildcraftPipe.pipepowergold"));
    } else {
        pipeFluidStone = "blockGlass";
        pipeEnergyGold = "dustRedstone";
    }
    
    if (Loader.isModLoaded("BuildCraft|Energy")) {
        Block engine = GameRegistry.findBlock("BuildCraft|Core", "engineBlock");
        if (engine == null) {
            engine = GameRegistry.findBlock("BuildCraft|Energy", "engineBlock");
        }
        
        engineCombustion = new ItemStack(engine, 1, 2);
    } else {
        engineCombustion = "gearIron";
    }
    
    if (Loader.isModLoaded("BuildCraft|Factory")) {
        tank = new ItemStack(GameRegistry.findBlock("BuildCraft|Factory", "tankBlock"));
    } else {
        tank = "blockGlass";
    }
    
    if (Loader.isModLoaded("BuildCraft|Silicon")) {
        chipsetGold = new ItemStack(GameRegistry.findItem("BuildCraft|Silicon", "redstoneChipset"), 1, 2);
    } else {
        chipsetGold = "gearGold";
    }
}
 
Example 5
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 6
Source File: BlockNameConversion.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
public static Block findBlock(String oldname) {
	FMLLog.getLogger().trace("[Chisel 2] findBlock() START: " + oldname);
	Block block = null;
	for (int i = 0; i < NameConversions.MAX && block == null; i++) {
		FMLLog.getLogger().trace("[Chisel 2] findBlock()       Checking for " + NameConversions.conversion(oldname, i));
		block = GameRegistry.findBlock(Chisel.MOD_ID, NameConversions.conversion(oldname, i));
	}

	return block;
}
 
Example 7
Source File: ConfigManager.java    From GardenCollection with MIT License 5 votes vote down vote up
private void parseStrangePlantItems (Property property) {
    String[] entries = property.getStringList();
    if (entries == null || entries.length == 0) {
        strangePlantDrops = new ItemStack[0];
        return;
    }

    List<ItemStack> results = new ArrayList<ItemStack>();

    for (String entry : entries) {
        UniqueMetaIdentifier uid = new UniqueMetaIdentifier(entry);
        int meta = (uid.meta == OreDictionary.WILDCARD_VALUE) ? 0 : uid.meta;

        Item item = GameRegistry.findItem(uid.modId, uid.name);
        if (item != null) {
            results.add(new ItemStack(item, 1, meta));
            continue;
        }

        Block block = GameRegistry.findBlock(uid.modId, uid.name);
        if (block != null) {
            item = Item.getItemFromBlock(block);
            if (item != null) {
                results.add(new ItemStack(item, 1, meta));
                continue;
            }
        }
    }

    strangePlantDrops = new ItemStack[results.size()];
    for (int i = 0; i < results.size(); i++)
        strangePlantDrops[i] = results.get(i);
}
 
Example 8
Source File: EIOItems.java    From SimplyJetpacks with MIT License 5 votes vote down vote up
public static void init() {
    SimplyJetpacks.logger.info("Stealing Ender IO's items");
    
    capacitorBankOld = new ItemStack(GameRegistry.findBlock("EnderIO", "blockCapacitorBank"));
    
    Block capBankBlock = GameRegistry.findBlock("EnderIO", "blockCapBank");
    capacitorBank = new ItemStack(capBankBlock, 1, 2);
    capacitorBankVibrant = new ItemStack(capBankBlock, 1, 3);
    
    redstoneConduit = new ItemStack(GameRegistry.findItem("EnderIO", "itemRedstoneConduit"), 1, 2);
    
    Item energyConduitItem = GameRegistry.findItem("EnderIO", "itemPowerConduit");
    energyConduit1 = new ItemStack(energyConduitItem, 1, 0);
    energyConduit2 = new ItemStack(energyConduitItem, 1, 1);
    energyConduit3 = new ItemStack(energyConduitItem, 1, 2);
    
    Item capacitorItem = GameRegistry.findItem("EnderIO", "itemBasicCapacitor");
    basicCapacitor = new ItemStack(capacitorItem, 1, 0);
    doubleCapacitor = new ItemStack(capacitorItem, 1, 1);
    octadicCapacitor = new ItemStack(capacitorItem, 1, 2);
    
    Item machinePartItem = GameRegistry.findItem("EnderIO", "itemMachinePart");
    machineChassis = new ItemStack(machinePartItem, 1, 0);
    basicGear = new ItemStack(machinePartItem, 1, 1);
    
    Item materialsItem = GameRegistry.findItem("EnderIO", "itemMaterial");
    pulsatingCrystal = new ItemStack(materialsItem, 1, 5);
    vibrantCrystal = new ItemStack(materialsItem, 1, 6);
    enderCrystal = new ItemStack(materialsItem, 1, 8);
}
 
Example 9
Source File: TwilightForestIntegration.java    From GardenCollection with MIT License 5 votes vote down vote up
private static void initWood () {
    Block log = GameRegistry.findBlock(MOD_ID, "tile.TFLog");
    Block magicLog = GameRegistry.findBlock(MOD_ID, "tile.TFMagicLog");

    Block leaves = GameRegistry.findBlock(MOD_ID, "tile.TFLeaves");  // (oak, canopy, mangrove, rainbow)
    Block magicLeaves = GameRegistry.findBlock(MOD_ID, "tile.TFMagicLeaves"); // (time, trans, mine, sort)
    Block darkLeaves = GameRegistry.findBlock(MOD_ID, "tile.DarkLeaves");

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

    WoodRegistry woodReg = WoodRegistry.instance();

    woodReg.registerWoodType(log, 0);   // Oak
    woodReg.registerWoodType(log, 1);   // Canopy
    woodReg.registerWoodType(log, 2);   // Mangrove
    woodReg.registerWoodType(log, 3);   // Darkwood

    woodReg.registerWoodType(magicLog, 0);  // Time
    woodReg.registerWoodType(magicLog, 1);  // Transform
    woodReg.registerWoodType(magicLog, 2);  // Mine
    woodReg.registerWoodType(magicLog, 3);  // Sort

    SaplingRegistry saplingReg = SaplingRegistry.instance();

    saplingReg.registerSapling(sapling, 0, log, 0, leaves, 0);  // Oak
    saplingReg.registerSapling(sapling, 1, log, 1, leaves, 1);  // Canopy
    saplingReg.registerSapling(sapling, 2, log, 2, leaves, 2);  // mangrove
    saplingReg.registerSapling(sapling, 3, log, 3, darkLeaves, 0);  // Darkwood
    saplingReg.registerSapling(sapling, 4, log, 0, leaves, 0);  // Hollow Oak
    saplingReg.registerSapling(sapling, 5, magicLog, 0, magicLeaves, 0);  // Time
    saplingReg.registerSapling(sapling, 6, magicLog, 1, magicLeaves, 1);  // Transform
    saplingReg.registerSapling(sapling, 7, magicLog, 2, magicLeaves, 2);  // Mine
    saplingReg.registerSapling(sapling, 8, magicLog, 3, magicLeaves, 3);  // Sort
    saplingReg.registerSapling(sapling, 9, log, 0, leaves, 3);  // Rainbow
}
 
Example 10
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 11
Source File: WitcheryIntegration.java    From GardenCollection with MIT License 5 votes vote down vote up
private static void initWood () {
    Block log = GameRegistry.findBlock(MOD_ID, "witchlog");
    Block leaf = GameRegistry.findBlock(MOD_ID, "witchleaves");
    Item sapling = GameRegistry.findItem(MOD_ID, "witchsapling");

    WoodRegistry woodReg = WoodRegistry.instance();

    for (int i = 0; i < 3; i++)
        woodReg.registerWoodType(log, i);

    SaplingRegistry saplingReg = SaplingRegistry.instance();

    for (int i = 0; i < 3; i++)
        saplingReg.registerSapling(sapling, i, log, i, leaf, i);
}
 
Example 12
Source File: ComputerCraft.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init(){
    if(Loader.isModLoaded(ModIds.OPEN_COMPUTERS)) super.init();
    Block modem = GameRegistry.findBlock(ModIds.COMPUTERCRAFT, "CC-Peripheral");
    if(modem != null) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(droneInterface), true, " u ", "mp ", "iii", 'u', new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_RANGE), 'm', new ItemStack(modem, 1, 1), 'p', Itemss.printedCircuitBoard, 'i', Names.INGOT_IRON_COMPRESSED));
    } else {
        Log.error("Wireless Modem block not found! Using the backup recipe");
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(droneInterface), true, " u ", "mp ", "iii", 'u', new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_RANGE), 'm', Items.ender_pearl, 'p', Itemss.printedCircuitBoard, 'i', Names.INGOT_IRON_COMPRESSED));
    }
}
 
Example 13
Source File: ExtraBiomesXLIntegration.java    From GardenCollection with MIT License 4 votes vote down vote up
private static void initWood () {
    Block log1 = GameRegistry.findBlock(MOD_ID, "log1");
    Block log2 = GameRegistry.findBlock(MOD_ID, "log2");
    Block log3 = GameRegistry.findBlock(MOD_ID, "mini_log_1");

    Block leaf1 = GameRegistry.findBlock(MOD_ID, "leaves_1"); // Brown, Orange, Purple, Yellow
    Block leaf2 = GameRegistry.findBlock(MOD_ID, "leaves_2"); // Bald Cyprus, Japanese Maple, Shrub, Rainbow Eucalyptus
    Block leaf3 = GameRegistry.findBlock(MOD_ID, "leaves_3"); // Sakura
    Block leaf4 = GameRegistry.findBlock(MOD_ID, "leaves_4"); // Fir, Redwood, Acacia, Cyprus

    Item sapling = GameRegistry.findItem(MOD_ID, "saplings_1");
    Item sapling2 = GameRegistry.findItem(MOD_ID, "saplings_2");

    WoodRegistry woodReg = WoodRegistry.instance();

    woodReg.registerWoodType(log1, 0); // Fir
    woodReg.registerWoodType(log1, 1); // Acacia
    woodReg.registerWoodType(log1, 2); // Cyprus
    woodReg.registerWoodType(log1, 3); // Japanese Maple

    woodReg.registerWoodType(log2, 0); // Rainbow Eucalyptus
    woodReg.registerWoodType(log2, 1); // Autumn
    woodReg.registerWoodType(log2, 2); // Bald Cyprus
    woodReg.registerWoodType(log2, 3); // Redwood

    woodReg.registerWoodType(log3, 0); // Sakura

    SaplingRegistry saplingReg = SaplingRegistry.instance();

    saplingReg.registerSapling(sapling, 0, log2, 1, leaf1, 0); // Umber Autumn
    saplingReg.registerSapling(sapling, 1, log2, 1, leaf1, 1); // Goldenrod Autumn
    saplingReg.registerSapling(sapling, 2, log2, 1, leaf1, 2); // Vermillion Autumn
    saplingReg.registerSapling(sapling, 3, log2, 1, leaf1, 3); // Citrine Autumn
    saplingReg.registerSapling(sapling, 4, log1, 0, leaf4, 0); // Fir
    saplingReg.registerSapling(sapling, 5, log2, 3, leaf4, 1); // Redwood
    saplingReg.registerSapling(sapling, 6, log1, 1, leaf4, 2); // Acacia
    saplingReg.registerSapling(sapling, 7, log1, 2, leaf4, 3); // Cyprus

    saplingReg.registerSapling(sapling2, 0, log2, 2, leaf2, 0); // Bald Cyprus
    saplingReg.registerSapling(sapling2, 1, log1, 3, leaf2, 1); // Japanese Maple
    saplingReg.registerSapling(sapling2, 2, log1, 3, leaf2, 2); // Japanese Maple Shrub
    saplingReg.registerSapling(sapling2, 3, log2, 0, leaf2, 3); // Rainbow Eucalyptus
    saplingReg.registerSapling(sapling2, 4, log3, 0, leaf3, 0); // Sakura
}
 
Example 14
Source File: BiomesOPlenty.java    From GardenCollection with MIT License 4 votes vote down vote up
private void initWood () {
    Block log1 = GameRegistry.findBlock(MOD_ID, "logs1");
    Block log2 = GameRegistry.findBlock(MOD_ID, "logs2");
    Block log3 = GameRegistry.findBlock(MOD_ID, "logs3");
    Block log4 = GameRegistry.findBlock(MOD_ID, "logs4");
    Block bamboo = GameRegistry.findBlock(MOD_ID, "bamboo");

    Block leaf1 = GameRegistry.findBlock(MOD_ID, "leaves1");
    Block leaf2 = GameRegistry.findBlock(MOD_ID, "leaves2");
    Block leaf3 = GameRegistry.findBlock(MOD_ID, "leaves3");
    Block leaf4 = GameRegistry.findBlock(MOD_ID, "leaves4");
    Block leafc1 = GameRegistry.findBlock(MOD_ID, "colorizedLeaves1");
    Block leafc2 = GameRegistry.findBlock(MOD_ID, "colorizedLeaves2");
    Block leafApple = GameRegistry.findBlock(MOD_ID, "appleLeaves");
    Block leafPersimmon = GameRegistry.findBlock(MOD_ID, "persimmonLeaves");

    Item sapling = GameRegistry.findItem(MOD_ID, "saplings");
    Item sapling2 = GameRegistry.findItem(MOD_ID, "colorizedSaplings");

    WoodRegistry woodReg = WoodRegistry.instance();

    woodReg.registerWoodType(log1, 0);
    woodReg.registerWoodType(log1, 1);
    woodReg.registerWoodType(log1, 2);
    woodReg.registerWoodType(log1, 3);

    woodReg.registerWoodType(log2, 0);
    woodReg.registerWoodType(log2, 1);
    woodReg.registerWoodType(log2, 2);
    woodReg.registerWoodType(log2, 3);

    woodReg.registerWoodType(log3, 0);
    woodReg.registerWoodType(log3, 1);
    woodReg.registerWoodType(log3, 2);
    woodReg.registerWoodType(log3, 3);

    woodReg.registerWoodType(log4, 0);
    woodReg.registerWoodType(log4, 1);
    woodReg.registerWoodType(log4, 2);
    woodReg.registerWoodType(log4, 3);

    SaplingRegistry saplingReg = SaplingRegistry.instance();

    saplingReg.registerSapling(sapling, 0, Blocks.log, 0, leafApple, 0);
    saplingReg.registerSapling(sapling, 1, Blocks.log, 2, leaf1, 0); // Autumn Tree
    saplingReg.registerSapling(sapling, 2, bamboo, 0, leaf1, 1); // Bamboo
    saplingReg.registerSapling(sapling, 3, log2, 1, leaf1, 2); // Magic Tree
    saplingReg.registerSapling(sapling, 4, log1, 2, leaf1, 3); // Dark Tree
    saplingReg.registerSapling(sapling, 5, log3, 2, leaf2, 0); // Dead Tree
    saplingReg.registerSapling(sapling, 6, log1, 3, leaf2, 1); // Fir Tree
    saplingReg.registerSapling(sapling, 7, log2, 0, leaf2, 2); // Loftwood Tree
    saplingReg.registerSapling(sapling, 8, Blocks.log2, 1, leaf2, 3); // Autumn Tree
    saplingReg.registerSapling(sapling, 9, Blocks.log, 0, leaf3, 0); // Origin Tree
    saplingReg.registerSapling(sapling, 10, log1, 1, leaf3, 1); // Pink Cherry Tree
    saplingReg.registerSapling(sapling, 11, Blocks.log, 0, leaf3, 2); // Maple Tree
    saplingReg.registerSapling(sapling, 12, log1, 1, leaf3, 3); // White Cherry Tree
    saplingReg.registerSapling(sapling, 13, log4, 1, leaf4, 0); // Hellbark
    saplingReg.registerSapling(sapling, 14, log4, 2, leaf4, 1); // Jacaranda
    saplingReg.registerSapling(sapling, 15, Blocks.log, 0, leafPersimmon, 0); // Persimmon Tree

    saplingReg.registerSapling(sapling2, 0, log1, 0, leafc1, 0); // Sacred Oak Tree
    saplingReg.registerSapling(sapling2, 1, log2, 2, leafc1, 1); // Mangrove Tree
    saplingReg.registerSapling(sapling2, 2, log2, 3, leafc1, 2 | 4); // Palm Tree
    saplingReg.registerSapling(sapling2, 3, log3, 0, leafc1, 3); // Redwood Tree
    saplingReg.registerSapling(sapling2, 4, log3, 1, leafc2, 0); // Willow Tree
    saplingReg.registerSapling(sapling2, 5, log4, 0, leafc2, 1); // Pine Tree
    saplingReg.registerSapling(sapling2, 6, log4, 3, leafc2, 2); // Mahogany Tree

    Map<String, int[]> saplingBank1 = new HashMap<String, int[]>();
    saplingBank1.put("small_oak", new int[] { 0, 1, 3, 5, 8, 9, 10, 11, 12, 14, 15 });
    saplingBank1.put("small_pine", new int[] { 2 });
    saplingBank1.put("small_spruce", new int[] { 4, 6, 7 });

    Map<String, int[]> saplingBank2 = new HashMap<String, int[]>();
    saplingBank2.put("small_oak", new int[] { 1 });
    saplingBank2.put("small_pine", new int[] { 3, 5 });
    saplingBank2.put("small_palm", new int[] { 2 });
    saplingBank2.put("small_willow", new int[] { 4 });
    saplingBank2.put("small_mahogany", new int[] { 6 });
    saplingBank2.put("large_oak", new int[] { 0 });

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

    SmallTreeRegistryHelper.registerSaplings(banks);
}
 
Example 15
Source File: ModBlocks.java    From GardenCollection with MIT License 4 votes vote down vote up
public static Block get (String name) {
    return GameRegistry.findBlock(GardenStuff.MOD_ID, name);
}
 
Example 16
Source File: NaturaIntegration.java    From GardenCollection with MIT License 4 votes vote down vote up
private static void initWood () {
    Block logTree = GameRegistry.findBlock(MOD_ID, "tree");             // TreeBlock
    Block logRedwood = GameRegistry.findBlock(MOD_ID, "redwood");       // SimpleLog
    Block logWillow = GameRegistry.findBlock(MOD_ID, "willow");         // WillowBlock
    Block logBlood = GameRegistry.findBlock(MOD_ID, "bloodwood");       // LogTwoxTwo
    Block logDark = GameRegistry.findBlock(MOD_ID, "Dark Tree");        // DarkTreeBlock
    Block logOverworld = GameRegistry.findBlock(MOD_ID, "Rare Tree");   // OverworldTreeBlock

    Block leafNorm = GameRegistry.findBlock(MOD_ID, "floraleaves");            // NLeaves (redwood, eucalyptus, hopseed)
    Block leafNoColor = GameRegistry.findBlock(MOD_ID, "floraleavesnocolor");  // NLeavesNocolor (sakura, ghostwood, bloodwood, willow)
    Block leafDark = GameRegistry.findBlock(MOD_ID, "Dark Leaves");            // NLeavesDark (darkwood, darkwood_flower, darkwood_fruit, fusewood)
    Block leafOverworld = GameRegistry.findBlock(MOD_ID, "Rare Leaves");       // OverworldLeaves (maple, silverbell, purpleheart, tiger)

    Item saplingNorm = GameRegistry.findItem(MOD_ID, "florasapling");          // NSaplingBlock
    Item saplingOverworld = GameRegistry.findItem(MOD_ID, "Rare Sapling");     // OverworldSapling

    WoodRegistry woodReg = WoodRegistry.instance();

    woodReg.registerWoodType(logTree, 0);       // Eucalyptus
    woodReg.registerWoodType(logTree, 1);       // Sakura
    woodReg.registerWoodType(logTree, 2);       // Ghostwood
    woodReg.registerWoodType(logTree, 3);       // Hopseed

    woodReg.registerWoodType(logRedwood, 0);    // Redwood (bark)
    woodReg.registerWoodType(logRedwood, 1);    // Redwood (heart)

    woodReg.registerWoodType(logWillow, 0);     // Willow

    woodReg.registerWoodType(logBlood, 15);     // Bloodwood

    woodReg.registerWoodType(logDark, 0);       // Darkwood
    woodReg.registerWoodType(logDark, 1);       // Fusewood

    woodReg.registerWoodType(logOverworld, 0);  // Maple
    woodReg.registerWoodType(logOverworld, 1);  // Silverbell
    woodReg.registerWoodType(logOverworld, 2);  // Purpleheart
    woodReg.registerWoodType(logOverworld, 3);  // Tiger

    SaplingRegistry saplingReg = SaplingRegistry.instance();

    saplingReg.registerSapling(saplingNorm, 0, logRedwood, 0, leafNorm, 0);   // Redwood
    saplingReg.registerSapling(saplingNorm, 1, logTree, 0, leafNorm, 1);   // Eucalyptus
    saplingReg.registerSapling(saplingNorm, 2, logTree, 3, leafNorm, 2);   // Hopseed
    saplingReg.registerSapling(saplingNorm, 3, logTree, 1, leafNoColor, 0);   // Sakura
    saplingReg.registerSapling(saplingNorm, 4, logTree, 2, leafNoColor, 1);   // Ghostwood
    //saplingReg.registerSapling(saplingNorm, 5, logBlood, 1, leafNoColor, 2);   // Bloodwood
    saplingReg.registerSapling(saplingNorm, 6, logDark, 0, leafDark, 0);   // Darkwood
    saplingReg.registerSapling(saplingNorm, 7, logDark, 1, leafDark, 3);   // Fusewood

    saplingReg.registerSapling(saplingOverworld, 0, logOverworld, 0, leafOverworld, 0);   // Maple
    saplingReg.registerSapling(saplingOverworld, 1, logOverworld, 1, leafOverworld, 1);   // Silverbell
    saplingReg.registerSapling(saplingOverworld, 2, logOverworld, 2, leafOverworld, 2);   // Purpleheart
    saplingReg.registerSapling(saplingOverworld, 3, logOverworld, 3, leafOverworld, 3);   // Tiger
    saplingReg.registerSapling(saplingOverworld, 4, logWillow, 0, leafNoColor, 3);   // Willow
}
 
Example 17
Source File: OilGeneratorFix.java    From NewHorizonsCoreMod with GNU General Public License v3.0 4 votes vote down vote up
public OilGeneratorFix()
{
  super( ModFixName );
  _mBuildCraftOilBlock = GameRegistry.findBlock( "BuildCraft|Energy", "blockOil" );
  _mLog = MainRegistry.Logger;
}
 
Example 18
Source File: ModBlocks.java    From GardenCollection with MIT License 4 votes vote down vote up
public static Block get (String name) {
    return GameRegistry.findBlock(GardenTrees.MOD_ID, name);
}
 
Example 19
Source File: Compatibility.java    From Chisel-2 with GNU General Public License v2.0 4 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) {
		addSupport(name, GameRegistry.findBlock(modname, blockname), metadata, order);
	}
}
 
Example 20
Source File: AllPurposeDebugCommand.java    From NewHorizonsCoreMod with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void processCommand( ICommandSender pCmdSender, String[] pArgs )
{
  try
  {
    if( pArgs.length == 0 )
    {
      moarArgs( pCmdSender );
      return;
    }
    else if("ci".equalsIgnoreCase(pArgs[0]))
    {
      EntityPlayer tEP = (EntityPlayer) pCmdSender;
      World tWorldObj = tEP.worldObj;
      int x = (int) tEP.posX;
      int z = (int) tEP.posZ;
      BiomeGenBase tBiomeInfo = tWorldObj.getBiomeGenForCoords( x, z );

      PlayerChatHelper.SendInfo( pCmdSender, "POS: x/z %d / %d", x, z );
      PlayerChatHelper.SendInfo( pCmdSender, "DimID: %d", tWorldObj.provider.dimensionId );
      PlayerChatHelper.SendInfo( pCmdSender, "BiomeID / Name: %d / %s", tBiomeInfo.biomeID, tBiomeInfo.biomeName );
    }
    else if("reloadconfig".equalsIgnoreCase(pArgs[0]))
    {
      MainRegistry.CoreConfig.LoadConfig();
      PlayerChatHelper.SendInfo( pCmdSender, "Config reloaded" );
    }
    else if("test".equalsIgnoreCase(pArgs[0]))
    {
      if( pArgs.length == 2 )
      {
        PlayerChatHelper.SendInfo( pCmdSender, "LOC: %d %d %d", (int) ( (EntityPlayer) pCmdSender ).posX, (int) ( (EntityPlayer) pCmdSender ).posY, (int) ( (EntityPlayer) pCmdSender ).posZ );

        Vec3 calculatedPos = PlayerHelper.addDistanceByPlayerDirection( (EntityPlayer) pCmdSender, Integer.parseInt( pArgs[1] ) );

        PlayerChatHelper.SendInfo( pCmdSender, "Calculated Block: %d %d %d", (int) calculatedPos.xCoord, (int) calculatedPos.yCoord, (int) calculatedPos.zCoord );
        pCmdSender.getEntityWorld().setBlock( (int) calculatedPos.xCoord, (int) calculatedPos.yCoord, (int) calculatedPos.zCoord, Blocks.bedrock );
      }
      else {
          moarArgs(pCmdSender);
      }
    }
    else if("oilstruct".equalsIgnoreCase(pArgs[0]))
    {
      IModFix tModFix = ModFixesMaster.getModFixInstance( OilGeneratorFix.ModFixName );
      if( tModFix == null )
      {
        PlayerChatHelper.SendError( pCmdSender, "Required ModFix is not loaded" );
        return;
      }

      OilGeneratorFix tOilGenFix = (OilGeneratorFix) tModFix;

      if( pArgs.length == 5 )
      {
        String[] tBlock = pArgs[1].split( ":" );

        Vec3 tSourcePos = Vec3.createVectorHelper( ( (EntityPlayer) pCmdSender ).posX, (double) Integer.parseInt( pArgs[2] ), ( (EntityPlayer) pCmdSender ).posZ );
        // Offset Structure-gen by 50 Blocks from players current location
        Vec3 tOilStructPos = PlayerHelper.addDistanceByVecAndYaw( tSourcePos, ( (EntityPlayer) pCmdSender ).rotationYaw, 50 );

        int tStructRadius = Integer.parseInt( pArgs[3] );
        int tStructGroundLevel = Integer.parseInt( pArgs[4] );

        Block tTargetBlock = GameRegistry.findBlock( tBlock[0], tBlock[1] );
        if( tTargetBlock != null )
        {
          PlayerChatHelper.SendInfo( pCmdSender, "Creating oilStruct at location %d / %d / %d, radius [%d], virtual groundLevel [%d] with block [%s]", (int) tOilStructPos.xCoord, (int) tOilStructPos.yCoord, (int) tOilStructPos.zCoord, tStructRadius, tStructGroundLevel, pArgs[1] );
          tOilGenFix.buildOilStructure( ( (EntityPlayer) pCmdSender ).worldObj, new Random(), (int) tOilStructPos.xCoord, (int) tOilStructPos.yCoord, (int) tOilStructPos.zCoord, tStructRadius, tStructGroundLevel, tTargetBlock, false );
        }
        else {
            PlayerChatHelper.SendError(pCmdSender, "Unknown block [%s]", pArgs[1]);
        }
      }
      else
      {
        moarArgs( pCmdSender );
        return;
      }
    }
  }
  catch( Exception e )
  {
    e.printStackTrace();
    PlayerChatHelper.SendError( pCmdSender, "Unknown error occoured [%s]", e.getMessage() );
  }
}