From 93746e67e5035eb674badd7fd12bf35f4e16d116 Mon Sep 17 00:00:00 2001 From: Jimmy Jenkins Date: Fri, 21 Oct 2016 19:34:08 +0100 Subject: [PATCH] Finally fixed heart bug --- src/main/java/mchorse/metamorph/ClientProxy.java | 13 ------------- src/main/java/mchorse/metamorph/CommonProxy.java | 12 ------------ .../java/mchorse/metamorph/api/morph/Morph.java | 8 +------- .../network/client/ClientHandlerMorphPlayer.java | 3 ++- 4 files changed, 3 insertions(+), 33 deletions(-) diff --git a/src/main/java/mchorse/metamorph/ClientProxy.java b/src/main/java/mchorse/metamorph/ClientProxy.java index 06edfa8d..89549e53 100644 --- a/src/main/java/mchorse/metamorph/ClientProxy.java +++ b/src/main/java/mchorse/metamorph/ClientProxy.java @@ -13,7 +13,6 @@ import mchorse.metamorph.entity.EntityMorph; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.registry.RenderingRegistry; @@ -82,16 +81,4 @@ public void loadModels() } } } - - /** - * Checks if the player is side's own - * - * This method is responsible for determining to who player belongs. On - * client side it will return true in case if it's the client's player. - */ - @Override - public boolean isOwnPlayer(EntityPlayer player) - { - return player.worldObj.isRemote ? player == Minecraft.getMinecraft().thePlayer : true; - } } \ No newline at end of file diff --git a/src/main/java/mchorse/metamorph/CommonProxy.java b/src/main/java/mchorse/metamorph/CommonProxy.java index 4754f03f..d1064fac 100644 --- a/src/main/java/mchorse/metamorph/CommonProxy.java +++ b/src/main/java/mchorse/metamorph/CommonProxy.java @@ -9,7 +9,6 @@ import mchorse.metamorph.capabilities.morphing.MorphingStorage; import mchorse.metamorph.entity.EntityMorph; import mchorse.metamorph.network.Dispatcher; -import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.fml.common.registry.EntityRegistry; @@ -110,15 +109,4 @@ private void loadModel(String model, String filename) e.printStackTrace(); } } - - /** - * Checks if the player is side's own - * - * This method is responsible for determining to who player belongs. On - * server side it will always return true. - */ - public boolean isOwnPlayer(EntityPlayer player) - { - return true; - } } \ No newline at end of file diff --git a/src/main/java/mchorse/metamorph/api/morph/Morph.java b/src/main/java/mchorse/metamorph/api/morph/Morph.java index 7071e221..3f1c1271 100644 --- a/src/main/java/mchorse/metamorph/api/morph/Morph.java +++ b/src/main/java/mchorse/metamorph/api/morph/Morph.java @@ -1,6 +1,5 @@ package mchorse.metamorph.api.morph; -import mchorse.metamorph.Metamorph; import mchorse.metamorph.api.IAbility; import mchorse.metamorph.api.IAction; import mchorse.metamorph.api.IAttackAbility; @@ -134,11 +133,6 @@ public void demorph(EntityPlayer player) */ private void setHealth(EntityPlayer player, int health) { - if (!Metamorph.proxy.isOwnPlayer(player)) - { - return; - } - float ratio = player.getHealth() / player.getMaxHealth(); float proportionalHealth = Math.round(health * ratio); @@ -151,7 +145,7 @@ private void setHealth(EntityPlayer player, int health) */ private void setMaxHealth(EntityPlayer player, int health) { - if (player.getMaxHealth() != health && Metamorph.proxy.isOwnPlayer(player)) + if (player.getMaxHealth() != health) { player.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(health); } diff --git a/src/main/java/mchorse/metamorph/network/client/ClientHandlerMorphPlayer.java b/src/main/java/mchorse/metamorph/network/client/ClientHandlerMorphPlayer.java index a2082402..0bd62236 100644 --- a/src/main/java/mchorse/metamorph/network/client/ClientHandlerMorphPlayer.java +++ b/src/main/java/mchorse/metamorph/network/client/ClientHandlerMorphPlayer.java @@ -5,6 +5,7 @@ import mchorse.metamorph.network.common.PacketMorphPlayer; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -19,7 +20,7 @@ public void run(EntityPlayerSP player, PacketMorphPlayer message) if (capability != null) { - capability.setCurrentMorph(message.morph, player, true); + capability.setCurrentMorph(message.morph, (EntityPlayer) entity, true); } } }