package com.InfinityRaider.AgriCraft.init;

import com.InfinityRaider.AgriCraft.handler.ConfigurationHandler;
import com.InfinityRaider.AgriCraft.handler.VillageCreationHandler;
import com.InfinityRaider.AgriCraft.handler.VillagerTradeHandler;
import com.InfinityRaider.AgriCraft.reference.Reference;
import com.InfinityRaider.AgriCraft.utility.LogHelper;
import com.InfinityRaider.AgriCraft.world.StructureGreenhouse;
import com.InfinityRaider.AgriCraft.world.StructureGreenhouseIrrigated;
import cpw.mods.fml.common.registry.VillagerRegistry;
import net.minecraft.world.gen.structure.MapGenStructureIO;

public class WorldGen {
    public static void init() {
        //add greenhouses to villages
        try {
            MapGenStructureIO.func_143031_a(StructureGreenhouse.class, Reference.MOD_ID + ":Greenhouse");
        } catch (Exception exception) {
            LogHelper.info("Failed to load greenhouse to villages");
        }
        VillagerRegistry.instance().registerVillageCreationHandler(new VillageCreationHandler.GreenhouseHandler());

        //add irrigated greenhouses to villages
        if(!ConfigurationHandler.disableIrrigation) {
            try {
                MapGenStructureIO.func_143031_a(StructureGreenhouseIrrigated.class, Reference.MOD_ID + ":GreenhouseIrrigated");
            } catch (Exception exception) {
                LogHelper.info("Failed to load greenhouse to villages");
            }
            VillagerRegistry.instance().registerVillageCreationHandler(new VillageCreationHandler.GreenhouseIrrigatedHandler());
        }

        if (ConfigurationHandler.villagerEnabled) {
            VillagerRegistry.instance().registerVillagerId(ConfigurationHandler.villagerID);
            VillagerRegistry.instance().registerVillageTradeHandler(ConfigurationHandler.villagerID, new VillagerTradeHandler());
        }
    }
}

@@ -669,35 +669,465 @@
   //
-add greenhouses to villages
+register villagers%0A        if (ConfigurationHandler.villagerEnabled) %7B%0A            VillagerRegistry.instance().registerVillagerId(ConfigurationHandler.villagerID);%0A            VillagerRegistry.instance().registerVillageTradeHandler(ConfigurationHandler.villagerID, new VillagerTradeHandler());%0A        %7D%0A        //add greenhouses to villages%0A        VillagerRegistry.instance().registerVillageCreationHandler(new VillageCreationHandler.GreenhouseHandler());
 %0A   
@@ -1354,32 +1354,80 @@
 es%22);%0A        %7D%0A
+        //add irrigated greenhouses to villages%0A
         Villager
@@ -1506,32 +1506,41 @@
 ndler.Greenhouse
+Irrigated
 Handler());%0A%0A   
@@ -1538,57 +1538,8 @@
 ());
-%0A%0A        //add irrigated greenhouses to villages
 %0A   
@@ -1870,423 +1870,8 @@
   %7D%0A
-            VillagerRegistry.instance().registerVillageCreationHandler(new VillageCreationHandler.GreenhouseIrrigatedHandler());%0A        %7D%0A%0A        if (ConfigurationHandler.villagerEnabled) %7B%0A            VillagerRegistry.instance().registerVillagerId(ConfigurationHandler.villagerID);%0A            VillagerRegistry.instance().registerVillageTradeHandler(ConfigurationHandler.villagerID, new VillagerTradeHandler());%0A
     

Reorder VillageRegistration [cf push]