diff --git a/MODSRC/vazkii/botania/common/core/handler/ConfigHandler.java b/MODSRC/vazkii/botania/common/core/handler/ConfigHandler.java index f4b02650c..3b27b6a9f 100644 --- a/MODSRC/vazkii/botania/common/core/handler/ConfigHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/ConfigHandler.java @@ -45,6 +45,15 @@ public final class ConfigHandler { public static boolean fallenKanadeEnabled = true; public static boolean darkQuartzEnabled = true; + public static int shedRateChicken = 26000; + public static int shedRateSquid = 18000; + public static int shedRateVillager = 82000; + public static int shedRateSpider = 12000; + public static int shedRateBlaze = 8000; + public static int shedRateGhast = 9001; + public static int shedRateSkeleton = 36000; + public static int shedRateSlime = 21000; + public static int flowerQuantity = 3; public static int flowerDensity = 32; @@ -114,6 +123,30 @@ public final class ConfigHandler { desc = "Set to false to disable the Smokey Quartz blocks. This config option is here for those using Thaumic Tinkerer"; darkQuartzEnabled = loadPropBool("darkQuartz.enabled", desc, darkQuartzEnabled); + desc = "The average amount of ticks between a chicken randomly dropping a feather. Set to -1 to disable this feature"; + shedRateChicken = loadPropInt("shedRate.chicken", desc, shedRateChicken); + + desc = "The average amount of ticks between a squid randomly dropping an ink sac. Set to -1 to disable this feature"; + shedRateSquid = loadPropInt("shedRate.squid", desc, shedRateSquid); + + desc = "The average amount of ticks between a villager randomly dropping an emerald. Set to -1 to disable this feature"; + shedRateVillager = loadPropInt("shedRate.villager", desc, shedRateVillager); + + desc = "The average amount of ticks between a spider randomly dropping a piece of string. Set to -1 to disable this feature"; + shedRateSpider = loadPropInt("shedRate.spider", desc, shedRateSpider); + + desc = "The average amount of ticks between a blaze randomly dropping a piece of blaze powder. Set to -1 to disable this feature"; + shedRateBlaze = loadPropInt("shedRate.blaze", desc, shedRateBlaze); + + desc = "The average amount of ticks between a ghast randomly dropping a ghast tear. Set to -1 to disable this feature"; + shedRateGhast = loadPropInt("shedRate.ghast", desc, shedRateGhast); + + desc = "The average amount of ticks between a skeleton randomly dropping a bone. Set to -1 to disable this feature"; + shedRateSkeleton = loadPropInt("shedRate.skeleton", desc, shedRateSkeleton); + + desc = "The average amount of ticks between a slime randomly dropping a slimeball. Set to -1 to disable this feature"; + shedRateSlime = loadPropInt("shedRate.slime", desc, shedRateSlime); + desc = "The quanity of flower patches to generate in the world, defaults to 3, the lower the number the less patches geenrate."; flowerQuantity = loadPropInt("worldgen.flower.quantity", desc, 3); diff --git a/MODSRC/vazkii/botania/common/core/handler/SheddingHandler.java b/MODSRC/vazkii/botania/common/core/handler/SheddingHandler.java new file mode 100644 index 000000000..f815f7b2d --- /dev/null +++ b/MODSRC/vazkii/botania/common/core/handler/SheddingHandler.java @@ -0,0 +1,60 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jul 4, 2014, 10:38:50 PM (GMT)] + */ +package vazkii.botania.common.core.handler; + +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.init.Items; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +public final class SheddingHandler { + + @SubscribeEvent + public void onLivingUpdate(LivingUpdateEvent event) { + if(event.entity.worldObj.isRemote) + return; + + if(event.entity instanceof EntityChicken) { + if(ConfigHandler.shedRateChicken != -1 && event.entity.worldObj.rand.nextInt(ConfigHandler.shedRateChicken) == 0) + event.entity.dropItem(Items.feather, 1); + } else if(event.entity instanceof EntitySquid) { + if(ConfigHandler.shedRateSquid != -1 && event.entity.worldObj.rand.nextInt(ConfigHandler.shedRateSquid) == 0) + event.entity.dropItem(Items.dye, 1); + } else if(event.entity instanceof EntityVillager) { + if(ConfigHandler.shedRateVillager != -1 && event.entity.worldObj.rand.nextInt(ConfigHandler.shedRateVillager) == 0) + event.entity.dropItem(Items.emerald, 1); + } else if(event.entity instanceof EntitySpider) { + if(ConfigHandler.shedRateSpider != -1 && event.entity.worldObj.rand.nextInt(ConfigHandler.shedRateSpider) == 0) + event.entity.dropItem(Items.string, 1); + } else if(event.entity instanceof EntityBlaze) { + if(ConfigHandler.shedRateBlaze != -1 && event.entity.worldObj.rand.nextInt(ConfigHandler.shedRateBlaze) == 0) + event.entity.dropItem(Items.blaze_rod, 1); + } else if(event.entity instanceof EntityGhast) { + if(ConfigHandler.shedRateGhast != -1 && event.entity.worldObj.rand.nextInt(ConfigHandler.shedRateGhast) == 0) + event.entity.dropItem(Items.ghast_tear, 1); + } else if(event.entity instanceof EntitySkeleton) { + if(ConfigHandler.shedRateSkeleton != -1 && event.entity.worldObj.rand.nextInt(ConfigHandler.shedRateSkeleton) == 0) + event.entity.dropItem(Items.bone, 1); + } else if(event.entity instanceof EntitySlime) { + if(ConfigHandler.shedRateSlime != -1 && event.entity.worldObj.rand.nextInt(ConfigHandler.shedRateSlime) == 0) + event.entity.dropItem(Items.slime_ball, 1); + } + } + +} diff --git a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java index f0c3c26fa..5714941e3 100644 --- a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java @@ -28,6 +28,7 @@ import vazkii.botania.common.core.handler.ConfigHandler; import vazkii.botania.common.core.handler.InternalMethodHandler; import vazkii.botania.common.core.handler.ManaNetworkHandler; import vazkii.botania.common.core.handler.PixieHandler; +import vazkii.botania.common.core.handler.SheddingHandler; import vazkii.botania.common.core.helper.Vector3; import vazkii.botania.common.core.version.CommandDownloadLatest; import vazkii.botania.common.crafting.ModCrafingRecipes; @@ -77,6 +78,7 @@ public class CommonProxy { MinecraftForge.TERRAIN_GEN_BUS.register(new BiomeDecorationHandler()); MinecraftForge.EVENT_BUS.register(ManaNetworkHandler.instance); MinecraftForge.EVENT_BUS.register(new PixieHandler()); + MinecraftForge.EVENT_BUS.register(new SheddingHandler()); FMLCommonHandler.instance().bus().register(new CommonTickHandler()); } diff --git a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java index bb2cf0dae..800f7e1e3 100644 --- a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java +++ b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java @@ -157,6 +157,7 @@ public final class LexiconData { public static LexiconEntry dispenserTweaks; public static LexiconEntry shinyFlowers; public static LexiconEntry prismarine; + public static LexiconEntry shedding; public static void init() { BotaniaAPI.addCategory(categoryBasics = new LexiconCategory(LibLexicon.CATEGORY_BASICS)); @@ -521,5 +522,8 @@ public final class LexiconData { prismarine = new BLexiconEntry(LibLexicon.MISC_PRISMARINE, categoryMisc); prismarine.setLexiconPages(new PageText("0"), new PageText("1"), new PageManaInfusionRecipe("2", ModManaAlchemyRecipes.prismarineRecipe), new PageCraftingRecipe("3", ModCrafingRecipes.recipePrismarine), new PageCraftingRecipe("4", ModCrafingRecipes.recipePrismarineBrick), new PageCraftingRecipe("5", ModCrafingRecipes.recipeDarkPrismarine), new PageCraftingRecipe("6", ModCrafingRecipes.recipeSeaLamp)); + + shedding = new BLexiconEntry(LibLexicon.MISC_SHEDDING, categoryMisc); + shedding.setLexiconPages(new PageText("0")); } } diff --git a/MODSRC/vazkii/botania/common/lib/LibLexicon.java b/MODSRC/vazkii/botania/common/lib/LibLexicon.java index dcc9b6ebf..ccda3bdcb 100644 --- a/MODSRC/vazkii/botania/common/lib/LibLexicon.java +++ b/MODSRC/vazkii/botania/common/lib/LibLexicon.java @@ -135,5 +135,6 @@ public final class LibLexicon { public static final String MISC_DISPENSER_TWEAKS = "dispenserTweaks"; public static final String MISC_SHINY_FLOWERS = "shinyFlowers"; public static final String MISC_PRISMARINE = "prismarine"; + public static final String MISC_SHEDDING = "shedding"; } diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index a7de464a8..e2ecb0f1b 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -93,6 +93,14 @@ versionChecking.enabled=Enable Version Checking wandBeam.static=Enable Static Wand Beam worldgen.flower.density=Worldgen Flower Density worldgen.flower.quantity=Worldgen Flower Quantity +shedRate.chicken=Shed Rate: Chicken +shedRate.squid=Shed Rate: Squid +shedRate.villager=Shed Rate: Villager +shedRate.spider=Shed Rate: Spider +shedRate.blaze=Shed Rate: Blaze +shedRate.ghast=Shed Rate: Ghast +shedRate.skeleton=Shed Rate: Skeleton +shedRate.slime=Shed Rate: Slime # VERSION CHECKING botania.versioning.flavour0=NANI SORE!? BOTANIA IS OUTDATED!? @@ -1306,3 +1314,7 @@ botania.page.prismarine3=Crafting &1Prismarine&0 botania.page.prismarine4=Crafting &1Prismarine Bricks&0 botania.page.prismarine5=Crafting &1Dark Prismarine&0 botania.page.prismarine6=Crafting the &1Sea Lantern&0 + +# -- NATURAL SHEDDING +botania.entry.shedding=Natural Shedding +botania.page.shedding0=The living beings that inhabit our lands don't live in a static state. It's common for pieces of their body to fall out, &1Feathers&0 on &4Chickens&0, &1Bones&0 on &4Skeletons&0, so on.
Even the tough &4Ghasts&0 sometimes shed a tear or the &4Villagers&0 accidently drop an &1Emerald&0 and can't pick it back up because their arms are stuck together for some reason. \ No newline at end of file