Search in sources :

Example 1 with FlowerRegistry

use of forestry.apiculture.flowers.FlowerRegistry in project ForestryMC by ForestryMC.

the class ModuleApiculture method initFlowerRegistry.

private void initFlowerRegistry() {
    FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
    flowerRegistry.registerAcceptableFlowerRule(new EndFlowerAcceptableRule(), FlowerManager.FlowerTypeEnd);
    // Register acceptable plants
    flowerRegistry.registerAcceptableFlower(Blocks.DRAGON_EGG, FlowerManager.FlowerTypeEnd);
    flowerRegistry.registerAcceptableFlower(Blocks.CHORUS_PLANT, FlowerManager.FlowerTypeEnd);
    flowerRegistry.registerAcceptableFlower(Blocks.CHORUS_FLOWER, FlowerManager.FlowerTypeEnd);
    flowerRegistry.registerAcceptableFlower(Blocks.VINE, FlowerManager.FlowerTypeJungle);
    flowerRegistry.registerAcceptableFlower(Blocks.TALLGRASS, FlowerManager.FlowerTypeJungle);
    flowerRegistry.registerAcceptableFlower(Blocks.WHEAT, FlowerManager.FlowerTypeWheat);
    flowerRegistry.registerAcceptableFlower(Blocks.PUMPKIN_STEM, FlowerManager.FlowerTypeGourd);
    flowerRegistry.registerAcceptableFlower(Blocks.MELON_STEM, FlowerManager.FlowerTypeGourd);
    flowerRegistry.registerAcceptableFlower(Blocks.NETHER_WART, FlowerManager.FlowerTypeNether);
    flowerRegistry.registerAcceptableFlower(Blocks.CACTUS, FlowerManager.FlowerTypeCacti);
    // Register plantable plants
    for (BlockFlower.EnumFlowerType flowerType : BlockFlower.EnumFlowerType.values()) {
        IBlockState blockState;
        switch(flowerType.getBlockType()) {
            case RED:
                blockState = Blocks.RED_FLOWER.getDefaultState().withProperty(Blocks.RED_FLOWER.getTypeProperty(), flowerType);
                break;
            case YELLOW:
                blockState = Blocks.YELLOW_FLOWER.getDefaultState().withProperty(Blocks.YELLOW_FLOWER.getTypeProperty(), flowerType);
                break;
            default:
                continue;
        }
        flowerRegistry.registerPlantableFlower(blockState, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
    }
    flowerRegistry.registerPlantableFlower(Blocks.BROWN_MUSHROOM.getDefaultState(), 1.0, FlowerManager.FlowerTypeMushrooms);
    flowerRegistry.registerPlantableFlower(Blocks.RED_MUSHROOM.getDefaultState(), 1.0, FlowerManager.FlowerTypeMushrooms);
    flowerRegistry.registerPlantableFlower(Blocks.CACTUS.getDefaultState(), 1.0, FlowerManager.FlowerTypeCacti);
    // Flower Pots
    IBlockState flowerPot = Blocks.FLOWER_POT.getBlockState().getBaseState();
    PropertyEnum<BlockFlowerPot.EnumFlowerType> CONTENTS = BlockFlowerPot.CONTENTS;
    String[] standardTypes = new String[] { FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow };
    for (BlockFlowerPot.EnumFlowerType flowerType : BlockFlowerPot.EnumFlowerType.values()) {
        if (flowerType == BlockFlowerPot.EnumFlowerType.EMPTY || flowerType.getName().contains("sapling") || flowerType == BlockFlowerPot.EnumFlowerType.DEAD_BUSH || flowerType == BlockFlowerPot.EnumFlowerType.FERN) {
            continue;
        } else if (flowerType == BlockFlowerPot.EnumFlowerType.MUSHROOM_RED || flowerType == BlockFlowerPot.EnumFlowerType.MUSHROOM_BROWN) {
            flowerRegistry.registerAcceptableFlower(flowerPot.withProperty(CONTENTS, flowerType), FlowerManager.FlowerTypeMushrooms);
        } else if (flowerType == BlockFlowerPot.EnumFlowerType.CACTUS) {
            flowerRegistry.registerAcceptableFlower(flowerPot.withProperty(CONTENTS, flowerType), FlowerManager.FlowerTypeCacti);
        } else {
            flowerRegistry.registerAcceptableFlower(flowerPot.withProperty(CONTENTS, flowerType), standardTypes);
        }
    }
}
Also used : BlockFlowerPot(net.minecraft.block.BlockFlowerPot) FlowerRegistry(forestry.apiculture.flowers.FlowerRegistry) IBlockState(net.minecraft.block.state.IBlockState) BlockFlower(net.minecraft.block.BlockFlower)

Example 2 with FlowerRegistry

use of forestry.apiculture.flowers.FlowerRegistry in project ForestryMC by ForestryMC.

the class VillageApiaristHouse method plantFlowerGarden.

private void plantFlowerGarden(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
    if (structureType == 1) {
        // desert
        setBlockState(world, Blocks.CACTUS.getDefaultState(), 4, 1, 7, box);
        return;
    }
    for (int i = minY; i <= maxY; ++i) {
        for (int j = minX; j <= maxX; ++j) {
            for (int k = minZ; k <= maxZ; ++k) {
                if (world.rand.nextBoolean()) {
                    int xCoord = getXWithOffset(j, k);
                    int yCoord = getYWithOffset(i);
                    int zCoord = getZWithOffset(j, k);
                    BlockPos pos = new BlockPos(xCoord, yCoord, zCoord);
                    IBlockState blockState = world.getBlockState(pos);
                    if (!Blocks.RED_FLOWER.canBlockStay(world, pos, blockState)) {
                        continue;
                    }
                    FlowerRegistry flowerRegistry = (FlowerRegistry) FlowerManager.flowerRegistry;
                    Flower flower = flowerRegistry.getRandomPlantableFlower(FlowerManager.FlowerTypeVanilla, world.rand);
                    if (flower != null) {
                        setBlockState(world, flower.getBlockState(), j, i, k, box);
                    }
                }
            }
        }
    }
}
Also used : Flower(forestry.apiculture.flowers.Flower) IBlockState(net.minecraft.block.state.IBlockState) FlowerRegistry(forestry.apiculture.flowers.FlowerRegistry) BlockPos(net.minecraft.util.math.BlockPos)

Example 3 with FlowerRegistry

use of forestry.apiculture.flowers.FlowerRegistry in project ForestryMC by ForestryMC.

the class ModuleApiculture method setupAPI.

@Override
public void setupAPI() {
    HiveManager.hiveRegistry = hiveRegistry = new HiveRegistry();
    HiveManager.genHelper = new HiveGenHelper();
    FlowerManager.flowerRegistry = new FlowerRegistry();
    BeeManager.commonVillageBees = new ArrayList<>();
    BeeManager.uncommonVillageBees = new ArrayList<>();
    BeeManager.beeFactory = new BeeFactory();
    BeeManager.beeMutationFactory = new BeeMutationFactory();
    BeeManager.jubilanceFactory = new JubilanceFactory();
    BeeManager.armorApiaristHelper = new ArmorApiaristHelper();
    // Init bee interface
    BeeManager.beeRoot = new BeeRoot();
    AlleleManager.alleleRegistry.registerSpeciesRoot(BeeManager.beeRoot);
    // Modes
    BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.easy);
    BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.normal);
    BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.hard);
    BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.hardcore);
    BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.insane);
    // Capabilities
    CapabilityManager.INSTANCE.register(IArmorApiarist.class, new NullStorage<>(), () -> ArmorApiarist.INSTANCE);
}
Also used : BeeFactory(forestry.apiculture.genetics.BeeFactory) JubilanceFactory(forestry.apiculture.genetics.JubilanceFactory) FlowerRegistry(forestry.apiculture.flowers.FlowerRegistry) HiveGenHelper(forestry.apiculture.worldgen.HiveGenHelper) BeeMutationFactory(forestry.apiculture.genetics.BeeMutationFactory) HiveRegistry(forestry.apiculture.worldgen.HiveRegistry) BeeRoot(forestry.apiculture.genetics.BeeRoot)

Aggregations

FlowerRegistry (forestry.apiculture.flowers.FlowerRegistry)3 IBlockState (net.minecraft.block.state.IBlockState)2 Flower (forestry.apiculture.flowers.Flower)1 BeeFactory (forestry.apiculture.genetics.BeeFactory)1 BeeMutationFactory (forestry.apiculture.genetics.BeeMutationFactory)1 BeeRoot (forestry.apiculture.genetics.BeeRoot)1 JubilanceFactory (forestry.apiculture.genetics.JubilanceFactory)1 HiveGenHelper (forestry.apiculture.worldgen.HiveGenHelper)1 HiveRegistry (forestry.apiculture.worldgen.HiveRegistry)1 BlockFlower (net.minecraft.block.BlockFlower)1 BlockFlowerPot (net.minecraft.block.BlockFlowerPot)1 BlockPos (net.minecraft.util.math.BlockPos)1