From 5ab72c60c6d2c8a483b7fd92d7fe996204f68920 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 27 Jan 2019 01:38:55 +0100 Subject: [PATCH] nerf the animal generator lol --- .../blocks/BlockAnimalGenerator.java | 27 ++++++++++++++++--- .../entries/creating/animal_generator.json | 4 +++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java index 0d8c1414..f43a7fc8 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java @@ -11,10 +11,13 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.INpc; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.passive.IAnimals; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent; +import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.living.LivingExperienceDropEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -27,6 +30,16 @@ public class BlockAnimalGenerator extends BlockContainerImpl { MinecraftForge.EVENT_BUS.register(this); } + @SubscribeEvent + public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) { + EntityLivingBase entity = event.getEntityLiving(); + if (entity.world.isRemote || !(entity instanceof IAnimals) || entity instanceof IMob || entity instanceof INpc) + return; + NBTTagCompound data = entity.getEntityData(); + int timeAlive = data.getInteger(NaturesAura.MOD_ID + ":time_alive"); + data.setInteger(NaturesAura.MOD_ID + ":time_alive", timeAlive + 1); + } + @SubscribeEvent public void onEntityDeath(LivingDeathEvent event) { EntityLivingBase entity = event.getEntityLiving(); @@ -37,14 +50,22 @@ public class BlockAnimalGenerator extends BlockContainerImpl { if (!(tile instanceof TileEntityAnimalGenerator)) return false; TileEntityAnimalGenerator gen = (TileEntityAnimalGenerator) tile; - entity.getEntityData().setBoolean(NaturesAura.MOD_ID + ":no_drops", true); + + NBTTagCompound data = entity.getEntityData(); + data.setBoolean(NaturesAura.MOD_ID + ":no_drops", true); if (gen.isBusy()) return false; boolean child = entity.isChild(); - int time = child ? 60 : 120; - int amount = child ? 40 : 60; + float timeMod = child ? 0.5F : 1; + float amountMod = child ? 0.667F : 1; + + int timeAlive = data.getInteger(NaturesAura.MOD_ID + ":time_alive"); + int time = Math.min(MathHelper.floor((timeAlive - 15000) / 500F * timeMod), 200); + int amount = Math.min(MathHelper.floor((timeAlive - 8000) / 250F * amountMod), 100); + if (time <= 0 || amount <= 0) + return false; gen.setGenerationValues(time, amount); BlockPos genPos = gen.getPos(); diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/animal_generator.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/animal_generator.json index ae900664..106c3ed9 100644 --- a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/animal_generator.json +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/animal_generator.json @@ -8,6 +8,10 @@ "type": "text", "text": "Creating $(aura) through natural substances can be a double-edged sword. Creating $(aura) using the $(item)Disentangler of Mortals$() is especially so: Killing any passive animal close to it will cause the animal's soul to be freed and spread into the environment in the form of a rather big amount of $(aura). For this, baby animals' souls are less fulfilled, causing less $(aura) to be dispersed." }, + { + "type": "text", + "text": "Additionally, the $(thing)longer$() an animal is alive, the more $(aura) it will generate - signifiantly more so, making it a lot more viable and efficient to create a device that makes the animals wait for a while until their slaughtering. To harvest souls at their most fulfilled, one should wait about $(thing)one and a half hours$() or so." + }, { "type": "text", "text": "It should be noted, also, that the animals whose souls are absorbed will not be lootable for their usual drops. Additionally, supplying the $(item)Disentangler of Mortals$() with a death while it is already in the process of converting a soul will cause both the animal's soul not to be freed and its remains not to be dropped."