From 376e39d792a8e62e8df667732a8034a684dd5b3f Mon Sep 17 00:00:00 2001 From: mcmonkey4eva Date: Wed, 30 Nov 2016 15:36:24 -0800 Subject: [PATCH] Fix potential issue with health trait, probably --- .../denizen/npc/traits/HealthTrait.java | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/plugin/src/main/java/net/aufdemrand/denizen/npc/traits/HealthTrait.java b/plugin/src/main/java/net/aufdemrand/denizen/npc/traits/HealthTrait.java index 08b5dcf6b0..f958df9ded 100644 --- a/plugin/src/main/java/net/aufdemrand/denizen/npc/traits/HealthTrait.java +++ b/plugin/src/main/java/net/aufdemrand/denizen/npc/traits/HealthTrait.java @@ -166,11 +166,13 @@ public void run() { if (npc.getEntity().getLocation().getY() < -1000) { npc.despawn(DespawnReason.DEATH); if (respawn) { + Location res = getRespawnLocation(); + res.setY(res.getWorld().getHighestBlockYAt(res.getBlockX(), res.getBlockZ())); if (npc.isSpawned()) { - npc.getEntity().teleport(getRespawnLocation()); + npc.getEntity().teleport(res); } else { - npc.spawn(getRespawnLocation()); + npc.spawn(res); } } } @@ -387,24 +389,4 @@ public void run() { } } - -// TODO: Figure something out here. Minecraft 'death effect' is too buggy to use anymore. -// -// public void playDeathAnimation(LivingEntity entity) { -// entity.playEffect(EntityEffect.DEATH); -// dMaterial mat = new dMaterial(Material.WOOL, 14); -// -// for (dPlayer player : Utilities.getClosestPlayers(entity.getLocation(), 10)) { -// for (Block block : CoreUtilities.getRandomSolidBlocks(entity.getLocation(), 3, 65)) -// new FakeBlock(player, new dLocation(block.getLocation()), -// mat, Duration.valueOf("10-20s")); -// } -// -// ParticleEffect.CRIT.play(entity.getEyeLocation(), .2f, .2f, .2f, 0, 3500); -// -// for (Block block : CoreUtilities.getRandomSolidBlocks(entity.getLocation(), 2, 5)) { -// entity.getWorld().dropItemNaturally(block.getLocation(), new ItemStack(Material.BONE)).setPickupDelay(Integer.MAX_VALUE); -// entity.getWorld().dropItemNaturally(block.getLocation(), new ItemStack(Material.REDSTONE, 1, (short) 14)).setPickupDelay(Integer.MAX_VALUE); -// } -// } }