From d773e5214c5308bbd461f558b9e17a4839027d5e Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Thu, 9 Jul 2015 21:33:49 +0100 Subject: - Pentagram now reduces the total health the victim has instead of damaging it (this is to prevent getting infinite hearts); - Fixed server-client sync issues (thanks domi) --- .../java/darkknight/jewelrycraft/entities/EntityHeart.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (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 aa8f5c8..793fcd5 100644 --- a/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java +++ b/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java @@ -8,6 +8,7 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EnumCreatureAttribute; 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.world.World; import cpw.mods.fml.relauncher.Side; @@ -15,6 +16,7 @@ import cpw.mods.fml.relauncher.SideOnly; import darkknight.jewelrycraft.JewelrycraftMod; import darkknight.jewelrycraft.config.ConfigHandler; import darkknight.jewelrycraft.network.PacketRequestPlayerInfo; +import darkknight.jewelrycraft.network.PacketSendClientPlayerInfo; import darkknight.jewelrycraft.util.JewelrycraftUtil; import darkknight.jewelrycraft.util.PlayerUtils; import darkknight.jewelrycraft.util.Variables; @@ -70,12 +72,14 @@ 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() + playerInfo.getFloat("WhiteHeart")); + player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + 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()); - else playerInfo.setFloat(getType() + "Heart", getQuantity()); - JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo()); + else playerInfo.setFloat(getType() + "Heart", getQuantity()); + JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP)player); this.setDead(); } } -- cgit v1.2.3