Search in sources :

Example 11 with ItemRegistryApiculture

use of forestry.apiculture.items.ItemRegistryApiculture in project ForestryMC by ForestryMC.

the class ModuleApiculture method registerBeehiveDrops.

private static void registerBeehiveDrops() {
    ItemRegistryApiculture items = getItems();
    ItemStack honeyComb = items.beeComb.get(EnumHoneyComb.HONEY, 1);
    HiveRegistry hiveRegistry = getHiveRegistry();
    hiveRegistry.addDrops(HiveType.FOREST.getHiveUid(), new HiveDrop(0.80, BeeDefinition.FOREST, honeyComb).setIgnobleShare(0.7), new HiveDrop(0.08, BeeDefinition.FOREST.getRainResist(), honeyComb), new HiveDrop(0.03, BeeDefinition.VALIANT, honeyComb));
    hiveRegistry.addDrops(HiveType.MEADOWS.getHiveUid(), new HiveDrop(0.80, BeeDefinition.MEADOWS, honeyComb).setIgnobleShare(0.7), new HiveDrop(0.03, BeeDefinition.VALIANT, honeyComb));
    ItemStack parchedComb = items.beeComb.get(EnumHoneyComb.PARCHED, 1);
    hiveRegistry.addDrops(HiveType.DESERT.getHiveUid(), new HiveDrop(0.80, BeeDefinition.MODEST, parchedComb).setIgnobleShare(0.7), new HiveDrop(0.03, BeeDefinition.VALIANT, parchedComb));
    ItemStack silkyComb = items.beeComb.get(EnumHoneyComb.SILKY, 1);
    hiveRegistry.addDrops(HiveType.JUNGLE.getHiveUid(), new HiveDrop(0.80, BeeDefinition.TROPICAL, silkyComb).setIgnobleShare(0.7), new HiveDrop(0.03, BeeDefinition.VALIANT, silkyComb));
    ItemStack mysteriousComb = items.beeComb.get(EnumHoneyComb.MYSTERIOUS, 1);
    hiveRegistry.addDrops(HiveType.END.getHiveUid(), new HiveDrop(0.90, BeeDefinition.ENDED, mysteriousComb));
    ItemStack frozenComb = items.beeComb.get(EnumHoneyComb.FROZEN, 1);
    hiveRegistry.addDrops(HiveType.SNOW.getHiveUid(), new HiveDrop(0.80, BeeDefinition.WINTRY, frozenComb).setIgnobleShare(0.5), new HiveDrop(0.03, BeeDefinition.VALIANT, frozenComb));
    ItemStack mossyComb = items.beeComb.get(EnumHoneyComb.MOSSY, 1);
    hiveRegistry.addDrops(HiveType.SWAMP.getHiveUid(), new HiveDrop(0.80, BeeDefinition.MARSHY, mossyComb).setIgnobleShare(0.4), new HiveDrop(0.03, BeeDefinition.VALIANT, mossyComb));
}
Also used : HiveDrop(forestry.apiculture.genetics.HiveDrop) ItemRegistryApiculture(forestry.apiculture.items.ItemRegistryApiculture) HiveRegistry(forestry.apiculture.worldgen.HiveRegistry) ItemStack(net.minecraft.item.ItemStack)

Example 12 with ItemRegistryApiculture

use of forestry.apiculture.items.ItemRegistryApiculture in project ForestryMC by ForestryMC.

the class ModuleApiculture method doInit.

// TODO: Buildcraft for 1.9
// @Override
// public void registerTriggers() {
// ApicultureTriggers.initialize();
// }
@Override
public void doInit() {
    File configFile = new File(Forestry.instance.getConfigFolder(), CONFIG_CATEGORY + ".cfg");
    LocalizedConfiguration config = new LocalizedConfiguration(configFile, "3.0.0");
    if (!Objects.equals(config.getLoadedConfigVersion(), config.getDefinedConfigVersion())) {
        boolean deleted = configFile.delete();
        if (deleted) {
            config = new LocalizedConfiguration(configFile, "3.0.0");
        }
    }
    initFlowerRegistry();
    List<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getBeekeepingModes();
    String[] validBeekeepingModeNames = new String[beekeepingModes.size()];
    for (int i = 0; i < beekeepingModes.size(); i++) {
        validBeekeepingModeNames[i] = beekeepingModes.get(i).getName();
    }
    beekeepingMode = config.getStringLocalized("beekeeping", "mode", "NORMAL", validBeekeepingModeNames);
    Log.debug("Beekeeping mode read from config: " + beekeepingMode);
    secondPrincessChance = config.getFloatLocalized("beekeeping", "second.princess", secondPrincessChance, 0.0f, 100.0f);
    maxFlowersSpawnedPerHive = config.getIntLocalized("beekeeping", "flowers.spawn", 20, 0, 1000);
    String[] blacklist = config.getStringListLocalized("species", "blacklist", Constants.EMPTY_STRINGS);
    parseBeeBlacklist(blacklist);
    ticksPerBeeWorkCycle = config.getIntLocalized("beekeeping", "ticks.work", 550, 250, 850);
    hivesDamageOnPeaceful = config.getBooleanLocalized("beekeeping", "hivedamage.peaceful", false);
    doSelfPollination = config.getBooleanLocalized("beekeeping", "self.pollination", false);
    config.save();
    // Genetics
    createAlleles();
    BeeDefinition.initBees();
    // Hives
    createHives();
    registerBeehiveDrops();
    ItemRegistryApiculture items = getItems();
    BlockRegistryApiculture blocks = getBlocks();
    // Inducers for swarmer
    BeeManager.inducers.put(items.royalJelly.getItemStack(), 10);
    GameRegistry.registerTileEntity(TileAlvearyPlain.class, "forestry.Alveary");
    GameRegistry.registerTileEntity(TileHive.class, "forestry.Swarm");
    GameRegistry.registerTileEntity(TileAlvearySwarmer.class, "forestry.AlvearySwarmer");
    GameRegistry.registerTileEntity(TileAlvearyHeater.class, "forestry.AlvearyHeater");
    GameRegistry.registerTileEntity(TileAlvearyFan.class, "forestry.AlvearyFan");
    GameRegistry.registerTileEntity(TileAlvearyHygroregulator.class, "forestry.AlvearyHygro");
    GameRegistry.registerTileEntity(TileAlvearyStabiliser.class, "forestry.AlvearyStabiliser");
    GameRegistry.registerTileEntity(TileAlvearySieve.class, "forestry.AlvearySieve");
    GameRegistry.registerTileEntity(TileCandle.class, "forestry.Candle");
    ResourceLocation beeHouseCartResource = new ResourceLocation(Constants.MOD_ID, "cart.beehouse");
    EntityUtil.registerEntity(beeHouseCartResource, EntityMinecartBeehouse.class, "cart.beehouse", 1, 0x000000, 0xffffff, 256, 3, true);
    ResourceLocation apiaryCartResource = new ResourceLocation(Constants.MOD_ID, "cart.apiary");
    EntityUtil.registerEntity(apiaryCartResource, EntityMinecartApiary.class, "cart.apiary", 2, 0x000000, 0xffffff, 256, 3, true);
    BeeManager.commonVillageBees.add(BeeDefinition.FOREST.getGenome());
    BeeManager.commonVillageBees.add(BeeDefinition.MEADOWS.getGenome());
    BeeManager.commonVillageBees.add(BeeDefinition.MODEST.getGenome());
    BeeManager.commonVillageBees.add(BeeDefinition.MARSHY.getGenome());
    BeeManager.commonVillageBees.add(BeeDefinition.WINTRY.getGenome());
    BeeManager.commonVillageBees.add(BeeDefinition.TROPICAL.getGenome());
    BeeManager.uncommonVillageBees.add(BeeDefinition.FOREST.getRainResist().getGenome());
    BeeManager.uncommonVillageBees.add(BeeDefinition.COMMON.getGenome());
    BeeManager.uncommonVillageBees.add(BeeDefinition.VALIANT.getGenome());
    if (Config.enableVillagers) {
        // Register villager stuff
        VillageCreationApiculture villageHandler = new VillageCreationApiculture();
        VillagerRegistry villagerRegistry = VillagerRegistry.instance();
        villagerRegistry.registerVillageCreationHandler(villageHandler);
        villagerApiarist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_APIARIST, Constants.TEXTURE_SKIN_BEEKPEEPER, Constants.TEXTURE_SKIN_ZOMBIE_BEEKPEEPER);
        IForgeRegistry<VillagerRegistry.VillagerProfession> villagerProfessions = ForgeRegistries.VILLAGER_PROFESSIONS;
        villagerProfessions.register(villagerApiarist);
        ItemStack wildcardPrincess = new ItemStack(items.beePrincessGE, 1);
        ItemStack wildcardDrone = new ItemStack(items.beeDroneGE, 1);
        ItemStack apiary = new ItemStack(blocks.apiary);
        ItemStack provenFrames = items.frameProven.getItemStack();
        ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE);
        ItemStack endDrone = BeeDefinition.ENDED.getMemberStack(EnumBeeType.DRONE);
        ItemStack propolis = new ItemStack(items.propolis, 1);
        VillagerRegistry.VillagerCareer apiaristCareer = new VillagerRegistry.VillagerCareer(villagerApiarist, "apiarist");
        apiaristCareer.addTrade(1, new VillagerApiaristTrades.GiveRandomCombsForItems(items.beeComb, new ItemStack(Items.WHEAT), new EntityVillager.PriceInfo(8, 12), new EntityVillager.PriceInfo(2, 4)), new VillagerApiaristTrades.GiveRandomCombsForItems(items.beeComb, new ItemStack(Items.CARROT), new EntityVillager.PriceInfo(8, 12), new EntityVillager.PriceInfo(2, 4)), new VillagerApiaristTrades.GiveRandomCombsForItems(items.beeComb, new ItemStack(Items.POTATO), new EntityVillager.PriceInfo(8, 12), new EntityVillager.PriceInfo(2, 4)));
        apiaristCareer.addTrade(2, new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 4), new ItemStack(items.smoker), null), new VillagerTradeLists.GiveItemForLogsAndEmeralds(apiary, new EntityVillager.PriceInfo(1, 1), new EntityVillager.PriceInfo(16, 32), new EntityVillager.PriceInfo(1, 2)), new VillagerApiaristTrades.GiveRandomHiveDroneForItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4)));
        apiaristCareer.addTrade(3, new VillagerTradeLists.GiveEmeraldForItems(wildcardPrincess, null), new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 2), provenFrames, new EntityVillager.PriceInfo(1, 6)));
        apiaristCareer.addTrade(4, new VillagerTradeLists.GiveItemForItemAndEmerald(wildcardPrincess, null, new EntityVillager.PriceInfo(10, 64), monasticDrone, null), new VillagerTradeLists.GiveItemForTwoItems(wildcardPrincess, null, new ItemStack(Items.ENDER_EYE), new EntityVillager.PriceInfo(12, 16), endDrone, null));
    }
    blocks.apiary.init();
    blocks.beeHouse.init();
    blocks.beeChest.init();
}
Also used : BlockRegistryApiculture(forestry.apiculture.blocks.BlockRegistryApiculture) ItemRegistryApiculture(forestry.apiculture.items.ItemRegistryApiculture) VillagerTradeLists(forestry.core.utils.VillagerTradeLists) ResourceLocation(net.minecraft.util.ResourceLocation) VillagerRegistry(net.minecraftforge.fml.common.registry.VillagerRegistry) IBeekeepingMode(forestry.api.apiculture.IBeekeepingMode) LocalizedConfiguration(forestry.core.config.LocalizedConfiguration) ItemStack(net.minecraft.item.ItemStack) File(java.io.File)

Example 13 with ItemRegistryApiculture

use of forestry.apiculture.items.ItemRegistryApiculture in project ForestryMC by ForestryMC.

the class ApicultureJeiPlugin method registerItemSubtypes.

@Override
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
    if (!ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE))) {
        return;
    }
    ItemRegistryApiculture items = ModuleApiculture.getItems();
    Preconditions.checkNotNull(items);
    ISubtypeRegistry.ISubtypeInterpreter beeSubtypeInterpreter = itemStack -> {
        IAlleleSpecies species = Genome.getSpeciesDirectly(BeeManager.beeRoot, itemStack);
        return species == null ? ISubtypeRegistry.ISubtypeInterpreter.NONE : species.getUID();
    };
    subtypeRegistry.registerSubtypeInterpreter(items.beeDroneGE, beeSubtypeInterpreter);
    subtypeRegistry.registerSubtypeInterpreter(items.beePrincessGE, beeSubtypeInterpreter);
    subtypeRegistry.registerSubtypeInterpreter(items.beeQueenGE, beeSubtypeInterpreter);
}
Also used : JEIPlugin(mezz.jei.api.JEIPlugin) IModRegistry(mezz.jei.api.IModRegistry) IAlleleSpecies(forestry.api.genetics.IAlleleSpecies) JeiUtil(forestry.core.utils.JeiUtil) ForestryModuleUids(forestry.modules.ForestryModuleUids) BeeManager(forestry.api.apiculture.BeeManager) ISubtypeRegistry(mezz.jei.api.ISubtypeRegistry) IModPlugin(mezz.jei.api.IModPlugin) ForestryAPI(forestry.api.core.ForestryAPI) Constants(forestry.core.config.Constants) ItemRegistryApiculture(forestry.apiculture.items.ItemRegistryApiculture) ResourceLocation(net.minecraft.util.ResourceLocation) Preconditions(com.google.common.base.Preconditions) Genome(forestry.core.genetics.Genome) ModuleApiculture(forestry.apiculture.ModuleApiculture) ResourceLocation(net.minecraft.util.ResourceLocation) ItemRegistryApiculture(forestry.apiculture.items.ItemRegistryApiculture) IAlleleSpecies(forestry.api.genetics.IAlleleSpecies) ISubtypeRegistry(mezz.jei.api.ISubtypeRegistry)

Example 14 with ItemRegistryApiculture

use of forestry.apiculture.items.ItemRegistryApiculture in project ForestryMC by ForestryMC.

the class BeeRoot method getType.

@Nullable
@Override
public EnumBeeType getType(ItemStack stack) {
    Item item = stack.getItem();
    ItemRegistryApiculture apicultureItems = ModuleApiculture.getItems();
    if (apicultureItems.beeDroneGE == item) {
        return EnumBeeType.DRONE;
    } else if (apicultureItems.beePrincessGE == item) {
        return EnumBeeType.PRINCESS;
    } else if (apicultureItems.beeQueenGE == item) {
        return EnumBeeType.QUEEN;
    } else if (apicultureItems.beeLarvaeGE == item) {
        return EnumBeeType.LARVAE;
    }
    return null;
}
Also used : Item(net.minecraft.item.Item) ItemRegistryApiculture(forestry.apiculture.items.ItemRegistryApiculture) Nullable(javax.annotation.Nullable)

Example 15 with ItemRegistryApiculture

use of forestry.apiculture.items.ItemRegistryApiculture in project ForestryMC by ForestryMC.

the class BeeRoot method getMemberStack.

@Override
public ItemStack getMemberStack(IIndividual individual, ISpeciesType type) {
    Preconditions.checkArgument(individual instanceof IBee, "individual is not a bee");
    Preconditions.checkArgument(type instanceof EnumBeeType, "type is not an EnumBeeType");
    ItemRegistryApiculture apicultureItems = ModuleApiculture.getItems();
    IBee bee = (IBee) individual;
    Item beeItem;
    switch((EnumBeeType) type) {
        case QUEEN:
            beeItem = apicultureItems.beeQueenGE;
            // ensure a queen is always mated
            if (bee.getMate() == null) {
                bee.mate(bee);
            }
            break;
        case PRINCESS:
            beeItem = apicultureItems.beePrincessGE;
            break;
        case DRONE:
            beeItem = apicultureItems.beeDroneGE;
            break;
        case LARVAE:
            beeItem = apicultureItems.beeLarvaeGE;
            break;
        default:
            throw new RuntimeException("Cannot instantiate a bee of type " + type);
    }
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    bee.writeToNBT(nbttagcompound);
    ItemStack beeStack = new ItemStack(beeItem);
    beeStack.setTagCompound(nbttagcompound);
    return beeStack;
}
Also used : Item(net.minecraft.item.Item) ItemRegistryApiculture(forestry.apiculture.items.ItemRegistryApiculture) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IBee(forestry.api.apiculture.IBee) ItemStack(net.minecraft.item.ItemStack) EnumBeeType(forestry.api.apiculture.EnumBeeType)

Aggregations

ItemRegistryApiculture (forestry.apiculture.items.ItemRegistryApiculture)16 ResourceLocation (net.minecraft.util.ResourceLocation)10 ItemStack (net.minecraft.item.ItemStack)9 ItemRegistryCore (forestry.core.items.ItemRegistryCore)5 Item (net.minecraft.item.Item)5 BlockRegistryApiculture (forestry.apiculture.blocks.BlockRegistryApiculture)3 FluidStack (net.minecraftforge.fluids.FluidStack)3 ICircuitLayout (forestry.api.circuits.ICircuitLayout)2 ItemRegistryFluids (forestry.core.items.ItemRegistryFluids)2 Preconditions (com.google.common.base.Preconditions)1 BeeManager (forestry.api.apiculture.BeeManager)1 EnumBeeType (forestry.api.apiculture.EnumBeeType)1 IBee (forestry.api.apiculture.IBee)1 IBeekeepingMode (forestry.api.apiculture.IBeekeepingMode)1 ICircuit (forestry.api.circuits.ICircuit)1 ForestryAPI (forestry.api.core.ForestryAPI)1 EngineBronzeFuel (forestry.api.fuels.EngineBronzeFuel)1 IAlleleSpecies (forestry.api.genetics.IAlleleSpecies)1 ICrateRegistry (forestry.api.storage.ICrateRegistry)1 ModuleApiculture (forestry.apiculture.ModuleApiculture)1