From 0ef6a00aa79f022e5bd56b3f77e6861bbecf6d94 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Thu, 13 Aug 2015 21:12:11 +0100 Subject: Added a new structure, a new curse, achievements, challenges, curses entry in the guide; reworked liquids to be tile entities, cleaned the structures code, potion code and... you know what? I improved and changed so much stuff that I literally forgot what I did... --- .../java/darkknight/jewelrycraft/entities/EntityHeart.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java') diff --git a/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java b/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java index 793fcd5..7f547bb 100644 --- a/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java +++ b/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java @@ -10,6 +10,9 @@ import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.DamageSource; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -73,8 +76,8 @@ public class EntityHeart extends EntityLiving { } else if (getType().equals("White") && playerInfo.getFloat("WhiteHeart") > 0.1F) { playerInfo.setFloat(getType() + "Heart", 0F); player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + 2f); + player.setHealth(player.getHealth() + 2f); JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP)player); -// player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + playerInfo.getFloat("WhiteHeart")); this.setDead(); } else if (!getType().equals("Red")) { if(playerInfo.hasKey(getType() + "Heart")) playerInfo.setFloat(getType() + "Heart", playerInfo.getFloat(getType() + "Heart") + getQuantity()); @@ -85,6 +88,13 @@ public class EntityHeart extends EntityLiving { } } } + + public void onDeath(DamageSource source) + { + super.onDeath(source); + if(source.getEntity() != null && source.getEntity() instanceof EntityPlayer) + ((EntityPlayer)source.getEntity()).addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".heartKilled."+this.getType()))); + } @SideOnly(Side.CLIENT) public boolean canRenderOnFire() { -- cgit v1.2.3