2015-08-29 14:33:25 +02:00
|
|
|
/*
|
|
|
|
* This file ("InitVillager.java") is part of the Actually Additions Mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2015-11-02 20:55:19 +01:00
|
|
|
* © 2015 Ellpeck
|
2015-08-29 14:33:25 +02:00
|
|
|
*/
|
|
|
|
|
2015-04-06 15:51:59 +02:00
|
|
|
package ellpeck.actuallyadditions.gen;
|
|
|
|
|
|
|
|
import cpw.mods.fml.common.registry.VillagerRegistry;
|
2015-04-24 19:22:03 +02:00
|
|
|
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
|
|
|
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
2015-04-06 15:51:59 +02:00
|
|
|
import ellpeck.actuallyadditions.items.InitItems;
|
|
|
|
import ellpeck.actuallyadditions.items.metalists.TheJams;
|
|
|
|
import ellpeck.actuallyadditions.util.ModUtil;
|
|
|
|
import net.minecraft.init.Items;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.WeightedRandomChestContent;
|
|
|
|
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
|
|
|
import net.minecraftforge.common.ChestGenHooks;
|
|
|
|
|
|
|
|
public class InitVillager{
|
|
|
|
|
2015-06-28 03:12:32 +02:00
|
|
|
public static final String JAM_HOUSE_CHEST_NAME = ModUtil.MOD_ID_LOWER+".jamHouseChest";
|
2015-04-06 15:51:59 +02:00
|
|
|
|
|
|
|
public static void init(){
|
2015-07-01 21:32:48 +02:00
|
|
|
ModUtil.LOGGER.info("Initializing Village Addons...");
|
2015-04-06 15:51:59 +02:00
|
|
|
|
2015-04-24 19:22:03 +02:00
|
|
|
if(ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()){
|
2015-06-28 03:12:32 +02:00
|
|
|
initJamVillagePart();
|
|
|
|
}
|
2015-06-29 20:55:56 +02:00
|
|
|
if(ConfigBoolValues.CROP_FIELD_EXISTS.isEnabled()){
|
|
|
|
initCustomCropFieldPart();
|
|
|
|
}
|
2015-06-28 03:12:32 +02:00
|
|
|
}
|
2015-04-06 15:51:59 +02:00
|
|
|
|
2015-06-28 03:12:32 +02:00
|
|
|
private static void initJamVillagePart(){
|
|
|
|
int jamID = ConfigIntValues.JAM_VILLAGER_ID.getValue();
|
|
|
|
VillagerRegistry.instance().registerVillagerId(jamID);
|
|
|
|
VillagerRegistry.instance().registerVillageTradeHandler(jamID, new JamVillagerTradeHandler());
|
2015-04-06 15:51:59 +02:00
|
|
|
|
2015-06-28 03:12:32 +02:00
|
|
|
ChestGenHooks jamHouseChest = ChestGenHooks.getInfo(JAM_HOUSE_CHEST_NAME);
|
|
|
|
jamHouseChest.setMin(5);
|
2015-06-29 20:55:56 +02:00
|
|
|
jamHouseChest.setMax(10);
|
2015-06-28 03:12:32 +02:00
|
|
|
for(int i = 0; i < TheJams.values().length; i++){
|
|
|
|
ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(InitItems.itemJams, 1, i), 1, 1, 10));
|
2015-04-06 15:51:59 +02:00
|
|
|
}
|
2015-06-28 03:12:32 +02:00
|
|
|
ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.glass_bottle), 1, 2, 30));
|
|
|
|
ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.potionitem), 1, 1, 20));
|
|
|
|
|
|
|
|
VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler());
|
|
|
|
MapGenStructureIO.func_143031_a(VillageComponentJamHouse.class, ModUtil.MOD_ID_LOWER+":jamHouseStructure");
|
2015-04-06 15:51:59 +02:00
|
|
|
}
|
|
|
|
|
2015-06-29 20:55:56 +02:00
|
|
|
private static void initCustomCropFieldPart(){
|
|
|
|
VillagerRegistry.instance().registerVillageCreationHandler(new VillageCustomCropFieldHandler());
|
|
|
|
MapGenStructureIO.func_143031_a(VillageComponentCustomCropField.class, ModUtil.MOD_ID_LOWER+":customCropFieldStructure");
|
|
|
|
}
|
|
|
|
|
2015-04-06 15:51:59 +02:00
|
|
|
}
|