Search in sources :

Example 1 with BlockRegistryLepidopterology

use of forestry.lepidopterology.blocks.BlockRegistryLepidopterology in project ForestryMC by ForestryMC.

the class ModuleLepidopterology method doInit.

@Override
public void doInit() {
    BlockRegistryLepidopterology blocks = getBlocks();
    GameRegistry.registerTileEntity(TileCocoon.class, "forestry.Cocoon");
    ModuleCore.rootCommand.addChildCommand(new CommandButterfly());
    ResourceLocation butterflyResourceLocation = new ResourceLocation(Constants.MOD_ID, "butterflyGE");
    EntityUtil.registerEntity(butterflyResourceLocation, EntityButterfly.class, "butterflyGE", 0, 0x000000, 0xffffff, 50, 1, true);
    MothDefinition.initMoths();
    ButterflyDefinition.initButterflies();
    ButterflyAlleles.createLoot();
    MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(ButterflyManager.butterflyRoot, IAlleleButterflySpecies.class));
    blocks.butterflyChest.init();
    if (spawnButterflysFromLeaves) {
        TreeManager.treeRoot.registerLeafTickHandler(new ButterflySpawner());
    }
    RecipeSorter.register("forestry:lepidopterologymating", MatingRecipe.class, RecipeSorter.Category.SHAPELESS, "before:minecraft:shapeless");
}
Also used : AlleleSpeciesRegisterEvent(forestry.api.genetics.AlleleSpeciesRegisterEvent) BlockRegistryLepidopterology(forestry.lepidopterology.blocks.BlockRegistryLepidopterology) ResourceLocation(net.minecraft.util.ResourceLocation) CommandButterfly(forestry.lepidopterology.commands.CommandButterfly) IAlleleButterflySpecies(forestry.api.lepidopterology.IAlleleButterflySpecies)

Example 2 with BlockRegistryLepidopterology

use of forestry.lepidopterology.blocks.BlockRegistryLepidopterology in project ForestryMC by ForestryMC.

the class ModuleLepidopterology method getHiddenItems.

@Override
public void getHiddenItems(List<ItemStack> hiddenItems) {
    BlockRegistryLepidopterology blocks = getBlocks();
    // cocoon itemBlock is different from the normal item
    hiddenItems.add(new ItemStack(blocks.cocoon));
    hiddenItems.add(new ItemStack(blocks.solidCocoon));
}
Also used : BlockRegistryLepidopterology(forestry.lepidopterology.blocks.BlockRegistryLepidopterology) ItemStack(net.minecraft.item.ItemStack)

Example 3 with BlockRegistryLepidopterology

use of forestry.lepidopterology.blocks.BlockRegistryLepidopterology in project ForestryMC by ForestryMC.

the class ModuleLepidopterology method registerItemsAndBlocks.

@Override
public void registerItemsAndBlocks() {
    items = new ItemRegistryLepidopterology();
    blocks = new BlockRegistryLepidopterology();
}
Also used : ItemRegistryLepidopterology(forestry.lepidopterology.items.ItemRegistryLepidopterology) BlockRegistryLepidopterology(forestry.lepidopterology.blocks.BlockRegistryLepidopterology)

Example 4 with BlockRegistryLepidopterology

use of forestry.lepidopterology.blocks.BlockRegistryLepidopterology in project ForestryMC by ForestryMC.

the class ModuleBackpacks method registerRecipes.

@Override
public void registerRecipes() {
    ItemRegistryBackpacks items = getItems();
    if (items.apiaristBackpack != null && ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE))) {
        BlockRegistryApiculture beeBlocks = ModuleApiculture.getBlocks();
        addBackpackRecipe("bee", items.apiaristBackpack, "stickWood", beeBlocks.beeChest);
    }
    if (items.lepidopteristBackpack != null && ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.LEPIDOPTEROLOGY))) {
        BlockRegistryLepidopterology butterflyBlocks = ModuleLepidopterology.getBlocks();
        ItemStack chest = new ItemStack(butterflyBlocks.butterflyChest);
        addBackpackRecipe("butterfly", items.lepidopteristBackpack, "stickWood", chest);
    }
    addBackpackRecipe("mining", items.minerBackpack, "ingotIron");
    addBackpackRecipe("digging", items.diggerBackpack, "stone");
    addBackpackRecipe("foresting", items.foresterBackpack, "logWood");
    addBackpackRecipe("hunting", items.hunterBackpack, Items.FEATHER);
    addBackpackRecipe("adventuring", items.adventurerBackpack, Items.BONE);
    addBackpackRecipe("building", items.builderBackpack, Items.CLAY_BALL);
    // / CARPENTER
    if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FACTORY))) {
        // / BACKPACKS WOVEN
        addT2BackpackRecipe(items.minerBackpack, items.minerBackpackT2);
        addT2BackpackRecipe(items.diggerBackpack, items.diggerBackpackT2);
        addT2BackpackRecipe(items.foresterBackpack, items.foresterBackpackT2);
        addT2BackpackRecipe(items.hunterBackpack, items.hunterBackpackT2);
        addT2BackpackRecipe(items.adventurerBackpack, items.adventurerBackpackT2);
        addT2BackpackRecipe(items.builderBackpack, items.builderBackpackT2);
    }
}
Also used : BlockRegistryApiculture(forestry.apiculture.blocks.BlockRegistryApiculture) BlockRegistryLepidopterology(forestry.lepidopterology.blocks.BlockRegistryLepidopterology) ItemRegistryBackpacks(forestry.storage.items.ItemRegistryBackpacks) ResourceLocation(net.minecraft.util.ResourceLocation) ItemStack(net.minecraft.item.ItemStack)

Example 5 with BlockRegistryLepidopterology

use of forestry.lepidopterology.blocks.BlockRegistryLepidopterology in project ForestryMC by ForestryMC.

the class ButterflyRoot method plantCocoon.

@Override
public BlockPos plantCocoon(World world, BlockPos coordinates, IButterfly caterpillar, GameProfile owner, int age, boolean createNursery) {
    if (caterpillar == null) {
        return BlockPos.ORIGIN;
    }
    BlockRegistryLepidopterology blocks = ModuleLepidopterology.getBlocks();
    BlockPos pos = getValidCocoonPos(world, coordinates, caterpillar, owner, createNursery);
    if (pos == BlockPos.ORIGIN) {
        return pos;
    }
    IBlockState state = blocks.cocoon.getDefaultState();
    boolean placed = world.setBlockState(pos, state);
    if (!placed) {
        return BlockPos.ORIGIN;
    }
    Block block = world.getBlockState(pos).getBlock();
    if (blocks.cocoon != block) {
        return BlockPos.ORIGIN;
    }
    TileCocoon cocoon = TileUtil.getTile(world, pos, TileCocoon.class);
    if (cocoon == null) {
        world.setBlockToAir(pos);
        return BlockPos.ORIGIN;
    }
    cocoon.setCaterpillar(caterpillar);
    cocoon.getOwnerHandler().setOwner(owner);
    cocoon.setAge(age);
    return pos;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockRegistryLepidopterology(forestry.lepidopterology.blocks.BlockRegistryLepidopterology) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.math.BlockPos) TileCocoon(forestry.lepidopterology.tiles.TileCocoon)

Aggregations

BlockRegistryLepidopterology (forestry.lepidopterology.blocks.BlockRegistryLepidopterology)6 ItemStack (net.minecraft.item.ItemStack)3 ItemRegistryLepidopterology (forestry.lepidopterology.items.ItemRegistryLepidopterology)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 AlleleSpeciesRegisterEvent (forestry.api.genetics.AlleleSpeciesRegisterEvent)1 IAlleleButterflySpecies (forestry.api.lepidopterology.IAlleleButterflySpecies)1 BlockRegistryApiculture (forestry.apiculture.blocks.BlockRegistryApiculture)1 CommandButterfly (forestry.lepidopterology.commands.CommandButterfly)1 MatingRecipe (forestry.lepidopterology.recipes.MatingRecipe)1 TileCocoon (forestry.lepidopterology.tiles.TileCocoon)1 ItemRegistryBackpacks (forestry.storage.items.ItemRegistryBackpacks)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 BlockPos (net.minecraft.util.math.BlockPos)1