Fix tough palms being trainable without an altar nearby (#1588)

*When using an empowered sacrificial dagger
This commit is contained in:
Nicholas Ignoffo 2019-05-19 09:04:20 -07:00
parent 39f1ac0c7d
commit 6420c2635e

View file

@ -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));