From 15110c7d7c2cae2a62ccb3e2de1fb84c852ea60d Mon Sep 17 00:00:00 2001 From: iChun Date: Sun, 5 Oct 2014 23:33:23 +0100 Subject: [PATCH] Fixes logging out mid-morph permanently changing your health for that lifetime, #589. --- .../java/morph/common/core/EventHandler.java | 16 +++++++++ .../assets/morph/mod/AbilitySupport.json | 36 +++++++++---------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/main/java/morph/common/core/EventHandler.java b/src/main/java/morph/common/core/EventHandler.java index 1243b5da..280c27f0 100644 --- a/src/main/java/morph/common/core/EventHandler.java +++ b/src/main/java/morph/common/core/EventHandler.java @@ -1664,6 +1664,22 @@ public void onPlayerLogout(PlayerEvent.PlayerLoggedOutEvent event) MorphInfo info = Morph.proxy.tickHandlerServer.playerMorphInfo.get(event.player.getCommandSenderName()); if(info != null) { + if(info.morphProgress < 80) + { + info.morphProgress = 80; + double nextMaxHealth = MathHelper.clamp_double(info.nextState.entInstance.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue(), 1D, 20D) + info.healthOffset; + + if(nextMaxHealth < 1D) + { + nextMaxHealth = 1D; + } + + if(nextMaxHealth != event.player.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue()) + { + event.player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(nextMaxHealth); + } + } + NBTTagCompound tag1 = new NBTTagCompound(); info.writeNBT(tag1); Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(event.player).setTag("morphData", tag1); diff --git a/src/main/resources/assets/morph/mod/AbilitySupport.json b/src/main/resources/assets/morph/mod/AbilitySupport.json index dad91d5a..002e8621 100644 --- a/src/main/resources/assets/morph/mod/AbilitySupport.json +++ b/src/main/resources/assets/morph/mod/AbilitySupport.json @@ -628,20 +628,20 @@ "hostile", "fly|true" ], -+ "f1repl4ce.unlogic.entities.FireSoul": [ -+ "hostile", -+ "fly|false", -+ "fireImmunity", -+ "float", -+ "witherResistance", -+ "fear|6,1.05D,f1repl4ce.unlogic.entities.DJACOB" -+ ], -+ "f1repl4ce.unlogic.entities.DJACOB": [ - -+ ], -+ "f1repl4ce.unlogic.entities.SnackAttackMan": [ -+ "witherResistance" -+ ], + "f1repl4ce.unlogic.entities.FireSoul": [ + "hostile", + "fly|false", + "fireImmunity", + "float", + "witherResistance", + "fear|6,1.05D,f1repl4ce.unlogic.entities.DJACOB" + ], + "f1repl4ce.unlogic.entities.DJACOB": [ + + ], + "f1repl4ce.unlogic.entities.SnackAttackMan": [ + "witherResistance" + ], "gaia.entity.EntityGaiaAnubis": [ "hostile" ], @@ -1492,7 +1492,7 @@ "tragicneko.tragicmc.entity.boss.EntityYeti": [ "hostile", "step|2.0F", - "fallNegate", + "fallNegate" ], "tragicneko.tragicmc.entity.mob.EntityAbomination": [ "hostile", @@ -1534,12 +1534,12 @@ ], "tragicneko.tragicmc.entity.mob.EntityPirah": [ "hostile", - "swim|false, 229479, 1.0F, 0.2F, true" + "swim|false,1.0F,0.2F,true" ], "tragicneko.tragicmc.entity.mob.EntityPlague": [ "hostile", "fly|false", - "swim|true, 892742, 1.0F, 1.0F, true" + "swim|true,1.0F,1.0F,true" ], "tragicneko.tragicmc.entity.mob.EntityPumpkinhead": [ "hostile" @@ -1559,7 +1559,7 @@ ], "tragicneko.tragicmc.entity.mob.EntityTox": [ "hostile", - "poisonResistance", + "poisonResistance" ], "tragicneko.tragicmc.entity.mob.EntityTragicNeko": [ "hostile"