Finished implementation of Incense Altar and associated blocks.

Also added the recipe for the Ritual Tinkerer, as well as the finalized book entry for the Incense Altar.
This commit is contained in:
WayofTime 2020-11-13 19:44:57 -05:00
parent 7634404dac
commit cb2db9bc50
108 changed files with 2197 additions and 81 deletions

View file

@ -0,0 +1,55 @@
package wayoftime.bloodmagic.util.helper;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import wayoftime.bloodmagic.util.Constants;
public class IncenseHelper
{
public static double getCurrentIncense(PlayerEntity player)
{
CompoundNBT data = player.getPersistentData();
if (data.contains(Constants.NBT.CURRENT_INCENSE))
{
return data.getDouble(Constants.NBT.CURRENT_INCENSE);
}
return 0;
}
public static void setCurrentIncense(PlayerEntity player, double amount)
{
CompoundNBT data = player.getPersistentData();
data.putDouble(Constants.NBT.CURRENT_INCENSE, amount);
}
public static void setMaxIncense(PlayerEntity player, double amount)
{
CompoundNBT data = player.getPersistentData();
data.putDouble(Constants.NBT.MAX_INCENSE, amount);
}
public static double getMaxIncense(PlayerEntity player)
{
CompoundNBT data = player.getPersistentData();
if (data.contains(Constants.NBT.MAX_INCENSE))
{
return data.getDouble(Constants.NBT.MAX_INCENSE);
}
return 0;
}
public static void setHasMaxIncense(ItemStack stack, PlayerEntity player, boolean isMax)
{
stack = NBTHelper.checkNBT(stack);
stack.getTag().putBoolean(Constants.NBT.HAS_MAX_INCENSE, isMax);
}
public static boolean getHasMaxIncense(ItemStack stack)
{
stack = NBTHelper.checkNBT(stack);
return stack.getTag().getBoolean(Constants.NBT.HAS_MAX_INCENSE);
}
}

View file

@ -19,35 +19,35 @@ public class PlayerSacrificeHelper
public static double getPlayerIncense(PlayerEntity player)
{
return 0;
// return IncenseHelper.getCurrentIncense(player);
// return 0;
return IncenseHelper.getCurrentIncense(player);
}
public static void setPlayerIncense(PlayerEntity player, double amount)
{
// IncenseHelper.setCurrentIncense(player, amount);
IncenseHelper.setCurrentIncense(player, amount);
}
public static boolean incrementIncense(PlayerEntity player, double min, double incenseAddition, double increment)
{
return true;
// double amount = getPlayerIncense(player);
// if (amount < min || amount >= incenseAddition)
// {
// return false;
// }
//
// amount = amount + Math.min(increment, incenseAddition - amount);
// setPlayerIncense(player, amount);
//
// if (amount == incenseAddition)
// {
// IncenseHelper.setMaxIncense(player, incenseAddition);
// }
// // System.out.println("Amount of incense: " + amount + ", Increment: " +
// // increment);
//
// return true;
double amount = getPlayerIncense(player);
if (amount < min || amount >= incenseAddition)
{
return false;
}
amount = amount + Math.min(increment, incenseAddition - amount);
setPlayerIncense(player, amount);
if (amount == incenseAddition)
{
IncenseHelper.setMaxIncense(player, incenseAddition);
}
// System.out.println("Amount of incense: " + amount + ", Increment: " +
// increment);
return true;
}
/**
@ -74,8 +74,7 @@ public class PlayerSacrificeHelper
if (health > maxHealth / 10.0)
{
float sacrificedHealth = health - maxHealth / 10.0f;
int lpAdded = (int) (sacrificedHealth * ConfigHandler.values.sacrificialDaggerConversion
* getModifier(amount));
int lpAdded = (int) (sacrificedHealth * ConfigHandler.values.sacrificialDaggerConversion * getModifier(amount));
IBloodAltar altar = getAltar(player.getEntityWorld(), player.getPosition());
if (altar != null)