From 6420c2635e92c99345a163f0ddd9fd62d8ae599f Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Sun, 19 May 2019 09:04:20 -0700 Subject: [PATCH] Fix tough palms being trainable without an altar nearby (#1588) *When using an empowered sacrificial dagger --- .../util/helper/PlayerSacrificeHelper.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/WayofTime/bloodmagic/util/helper/PlayerSacrificeHelper.java b/src/main/java/WayofTime/bloodmagic/util/helper/PlayerSacrificeHelper.java index 6498132d..54ceea6a 100644 --- a/src/main/java/WayofTime/bloodmagic/util/helper/PlayerSacrificeHelper.java +++ b/src/main/java/WayofTime/bloodmagic/util/helper/PlayerSacrificeHelper.java @@ -66,11 +66,15 @@ public class PlayerSacrificeHelper { float sacrificedHealth = health - maxHealth / 10.0f; int lpAdded = (int) (sacrificedHealth * ConfigHandler.values.sacrificialDaggerConversion * getModifier(amount)); - SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, (int) sacrificedHealth, lpAdded); - if (MinecraftForge.EVENT_BUS.post(evt)) - return false; + IBloodAltar altar = getAltar(player.getEntityWorld(), player.getPosition()); + if (altar != null) { + SacrificeKnifeUsedEvent evt = new SacrificeKnifeUsedEvent(player, true, true, (int) sacrificedHealth, lpAdded); + if (MinecraftForge.EVENT_BUS.post(evt)) + return false; + + altar.sacrificialDaggerCall(evt.lpAdded, false); + altar.startCycle(); - if (findAndFillAltar(player.getEntityWorld(), player, evt.lpAdded, false)) { player.setHealth(maxHealth / 10.0f); setPlayerIncense(player, 0); player.addPotionEffect(new PotionEffect(RegistrarBloodMagic.SOUL_FRAY, soulFrayDuration));