Search in sources :

Example 1 with VillagerRegistry

use of net.minecraftforge.fml.common.registry.VillagerRegistry in project Solar by Martacus.

the class ModVillage method registerProfession.

@SubscribeEvent
public static void registerProfession(RegistryEvent.Register<VillagerRegistry.VillagerProfession> event) {
    OLD_PRIEST_PROFESSION = new VillagerRegistry.VillagerProfession("solar:old_priest", "solar:textures/entity/villager/old_priest.png", "minecraft:textures/entity/zombie_villager/zombie_villager.png");
    event.getRegistry().register(OLD_PRIEST_PROFESSION);
    VillagerRegistry.VillagerCareer priest = new VillagerRegistry.VillagerCareer(OLD_PRIEST_PROFESSION, Solar.MODID + ".priest");
    priest.addTrade(1, new SolarTrade());
    VillagerRegistry villageRegistry = VillagerRegistry.instance();
    villageRegistry.registerVillageCreationHandler(new VillageOldPriestHouse.VillageManager());
    MapGenStructureIO.registerStructureComponent(VillageOldPriestHouse.class, Solar.MODID + ":OldPriestHouse");
}
Also used : VillagerRegistry(net.minecraftforge.fml.common.registry.VillagerRegistry) VillageOldPriestHouse(com.mart.solar.common.world.VillageOldPriestHouse) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with VillagerRegistry

use of net.minecraftforge.fml.common.registry.VillagerRegistry 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 3 with VillagerRegistry

use of net.minecraftforge.fml.common.registry.VillagerRegistry in project Binnie by ForestryMC.

the class ModuleCore method doInit.

@Override
public void doInit() {
    if (ConfigurationMain.hopeField) {
        VillageCreationExtraTrees villageHandler = new VillageCreationExtraTrees();
        VillagerRegistry villagerRegistry = VillagerRegistry.instance();
        villagerRegistry.registerVillageCreationHandler(villageHandler);
    }
    Food.CRABAPPLE.addJuice(10, 150, 10);
    Food.ORANGE.addJuice(10, 400, 15);
    Food.KUMQUAT.addJuice(10, 300, 10);
    Food.LIME.addJuice(10, 300, 10);
    Food.WILD_CHERRY.addOil(20, 50, 5);
    Food.SOUR_CHERRY.addOil(20, 50, 3);
    Food.BLACK_CHERRY.addOil(20, 50, 5);
    Food.Blackthorn.addJuice(10, 50, 5);
    Food.CHERRY_PLUM.addJuice(10, 100, 60);
    Food.ALMOND.addOil(20, 80, 5);
    Food.APRICOT.addJuice(10, 150, 40);
    Food.GRAPEFRUIT.addJuice(10, 500, 15);
    Food.PEACH.addJuice(10, 150, 40);
    Food.SATSUMA.addJuice(10, 300, 10);
    Food.BUDDHA_HAND.addJuice(10, 400, 15);
    Food.CITRON.addJuice(10, 400, 15);
    Food.FINGER_LIME.addJuice(10, 300, 10);
    Food.KEY_LIME.addJuice(10, 300, 10);
    Food.MANDERIN.addJuice(10, 400, 10);
    Food.NECTARINE.addJuice(10, 150, 40);
    Food.POMELO.addJuice(10, 300, 10);
    Food.TANGERINE.addJuice(10, 300, 10);
    Food.PEAR.addJuice(10, 300, 20);
    Food.SAND_PEAR.addJuice(10, 200, 10);
    Food.HAZELNUT.addOil(20, 150, 5);
    Food.BUTTERNUT.addOil(20, 180, 5);
    Food.BEECHNUT.addOil(20, 100, 4);
    Food.PECAN.addOil(29, 50, 2);
    Food.BANANA.addJuice(10, 100, 30);
    Food.RED_BANANA.addJuice(10, 100, 30);
    Food.PLANTAIN.addJuice(10, 100, 40);
    Food.BRAZIL_NUT.addOil(20, 20, 2);
    Food.FIG.addOil(20, 50, 3);
    Food.ACORN.addOil(20, 50, 3);
    Food.ELDERBERRY.addJuice(10, 100, 5);
    Food.OLIVE.addOil(20, 50, 3);
    Food.GINGKO_NUT.addOil(20, 50, 5);
    Food.COFFEE.addOil(15, 20, 2);
    Food.OSANGE_ORANGE.addJuice(10, 300, 15);
    Food.CLOVE.addOil(10, 25, 2);
    Food.COCONUT.addOil(20, 300, 25);
    Food.CASHEW.addJuice(10, 150, 15);
    Food.AVACADO.addJuice(10, 300, 15);
    Food.NUTMEG.addOil(20, 50, 10);
    Food.ALLSPICE.addOil(20, 50, 10);
    Food.CHILLI.addJuice(10, 100, 10);
    Food.STAR_ANISE.addOil(20, 100, 10);
    Food.MANGO.addJuice(10, 400, 20);
    Food.STARFRUIT.addJuice(10, 300, 10);
    Food.CANDLENUT.addJuice(20, 50, 10);
    RecipeUtil recipeUtil = new RecipeUtil(Constants.EXTRA_TREES_MOD_ID);
    MinecraftForge.addGrassSeed(new ItemStack(itemHops), 5);
    recipeUtil.addRecipe("durable_hammer", new ItemStack(itemDurableHammer, 1, 0), "wiw", " s ", " s ", 'w', Blocks.OBSIDIAN, 'i', Items.GOLD_INGOT, 's', Items.STICK);
    recipeUtil.addRecipe("hammer", new ItemStack(itemHammer, 1, 0), "wiw", " s ", " s ", 'w', "plankWood", 'i', Items.IRON_INGOT, 's', Items.STICK);
    recipeUtil.addRecipe("yeast", ExtraTreeItems.YEAST.get(8), " m ", "mbm", 'b', Items.BREAD, 'm', Blocks.BROWN_MUSHROOM);
    recipeUtil.addRecipe("lager_yeast", ExtraTreeItems.LAGER_YEAST.get(8), "mbm", " m ", 'b', Items.BREAD, 'm', Blocks.BROWN_MUSHROOM);
    recipeUtil.addRecipe("grain_wheat", ExtraTreeItems.GRAIN_WHEAT.get(5), " s ", "sss", " s ", 's', Items.WHEAT_SEEDS);
    recipeUtil.addRecipe("grain_barley", ExtraTreeItems.GRAIN_BARLEY.get(3), false, " s ", "s  ", " s ", 's', ExtraTreeItems.GRAIN_WHEAT.get(1));
    recipeUtil.addRecipe("grain_corn", ExtraTreeItems.GRAIN_CORN.get(3), false, " s ", "  s", " s ", 's', ExtraTreeItems.GRAIN_WHEAT.get(1));
    recipeUtil.addRecipe("grain_rye", ExtraTreeItems.GRAIN_RYE.get(3), "   ", "s s", " s ", 's', ExtraTreeItems.GRAIN_WHEAT.get(1));
    recipeUtil.addRecipe("proven_gear", ExtraTreeItems.PROVEN_GEAR.get(1), " s ", "s s", " s ", 's', Mods.Forestry.stack("oak_stick"));
    recipeUtil.addRecipe("glass_fitting", ExtraTreeItems.GLASS_FITTING.get(6), "s s", " i ", "s s", 'i', Items.IRON_INGOT, 's', Items.STICK);
    GameRegistry.addSmelting(ExtraTreeItems.GRAIN_WHEAT.get(1), ExtraTreeItems.GRAIN_ROASTED.get(1), 0.0f);
    GameRegistry.addSmelting(ExtraTreeItems.GRAIN_RYE.get(1), ExtraTreeItems.GRAIN_ROASTED.get(1), 0.0f);
    GameRegistry.addSmelting(ExtraTreeItems.GRAIN_CORN.get(1), ExtraTreeItems.GRAIN_ROASTED.get(1), 0.0f);
    GameRegistry.addSmelting(ExtraTreeItems.GRAIN_BARLEY.get(1), ExtraTreeItems.GRAIN_ROASTED.get(1), 0.0f);
    try {
        final Item minium = (Item) Class.forName("com.pahimar.ee3.lib.ItemIds").getField("minium_shard").get(null);
        recipeUtil.addShapelessRecipe("papayimar", Food.PAPAYIMAR.get(1), minium, "cropPapaya");
    } catch (Exception ignored) {
    }
    ICarpenterManager carpenterManager = RecipeManagers.carpenterManager;
    IStillManager stillManager = RecipeManagers.stillManager;
    stillManager.addRecipe(25, ExtraTreeLiquid.Resin.get(5), ExtraTreeLiquid.Turpentine.get(3));
    carpenterManager.addRecipe(25, ExtraTreeLiquid.Turpentine.get(50), ItemStack.EMPTY, itemMisc.getStack(ExtraTreeItems.WOOD_WAX, 4), "x", 'x', Mods.Forestry.stack("beeswax"));
    FluidStack creosoteOil = Binnie.LIQUID.getFluidStack(ManagerLiquid.CREOSOTE, 50);
    if (creosoteOil != null) {
        carpenterManager.addRecipe(25, creosoteOil, ItemStack.EMPTY, itemMisc.getStack(ExtraTreeItems.WOOD_WAX, 1), "x", 'x', Mods.Forestry.stack("beeswax"));
    }
    FuelManager.bronzeEngineFuel.put(ExtraTreeLiquid.Sap.get(1).getFluid(), new EngineBronzeFuel(ExtraTreeLiquid.Sap.get(1).getFluid(), 20, 10000, 1));
    FuelManager.bronzeEngineFuel.put(ExtraTreeLiquid.Resin.get(1).getFluid(), new EngineBronzeFuel(ExtraTreeLiquid.Resin.get(1).getFluid(), 30, 10000, 1));
}
Also used : Item(net.minecraft.item.Item) VillageCreationExtraTrees(binnie.extratrees.village.VillageCreationExtraTrees) FluidStack(net.minecraftforge.fluids.FluidStack) VillagerRegistry(net.minecraftforge.fml.common.registry.VillagerRegistry) EngineBronzeFuel(forestry.api.fuels.EngineBronzeFuel) ICarpenterManager(forestry.api.recipes.ICarpenterManager) IStillManager(forestry.api.recipes.IStillManager) ItemStack(net.minecraft.item.ItemStack) RecipeUtil(binnie.core.util.RecipeUtil)

Aggregations

VillagerRegistry (net.minecraftforge.fml.common.registry.VillagerRegistry)3 ItemStack (net.minecraft.item.ItemStack)2 RecipeUtil (binnie.core.util.RecipeUtil)1 VillageCreationExtraTrees (binnie.extratrees.village.VillageCreationExtraTrees)1 VillageOldPriestHouse (com.mart.solar.common.world.VillageOldPriestHouse)1 IBeekeepingMode (forestry.api.apiculture.IBeekeepingMode)1 EngineBronzeFuel (forestry.api.fuels.EngineBronzeFuel)1 ICarpenterManager (forestry.api.recipes.ICarpenterManager)1 IStillManager (forestry.api.recipes.IStillManager)1 BlockRegistryApiculture (forestry.apiculture.blocks.BlockRegistryApiculture)1 ItemRegistryApiculture (forestry.apiculture.items.ItemRegistryApiculture)1 LocalizedConfiguration (forestry.core.config.LocalizedConfiguration)1 VillagerTradeLists (forestry.core.utils.VillagerTradeLists)1 File (java.io.File)1 Item (net.minecraft.item.Item)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 FluidStack (net.minecraftforge.fluids.FluidStack)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1