nerf the animal generator lol

This commit is contained in:
Ellpeck 2019-01-27 01:38:55 +01:00
parent 05df830b74
commit 5ab72c60c6
2 changed files with 28 additions and 3 deletions

View file

@ -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();

View file

@ -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."