Third stage of "Dagger of Sacrifice"-glow (#1389)
* Added Soul Fray check. Sacrificial dagger now glows even more if you're fully prepared! Added NBT field for maximum incense altar bonus from the last incense altar the player has encountered. (There is a case in which the dagger glows even if the player is not at maximum incense bonus: The player must have been at maximum incense bonus and then gone into the vincinity of a stronger incense altar. The maximum incense bonus data field only updates once the maximum bonus has been reached for efficiency.) * Multiplayer fixed. * Fixed weirdness that occurred during a phase I don't remember.
This commit is contained in:
parent
2c92a9e0c1
commit
ecebe75f33
4 changed files with 51 additions and 10 deletions
|
@ -2,9 +2,11 @@ package WayofTime.bloodmagic.util.helper;
|
|||
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class IncenseHelper {
|
||||
|
||||
public static double getCurrentIncense(EntityPlayer player) {
|
||||
NBTTagCompound data = player.getEntityData();
|
||||
if (data.hasKey(Constants.NBT.CURRENT_INCENSE)) {
|
||||
|
@ -18,4 +20,26 @@ public class IncenseHelper {
|
|||
NBTTagCompound data = player.getEntityData();
|
||||
data.setDouble(Constants.NBT.CURRENT_INCENSE, amount);
|
||||
}
|
||||
|
||||
public static void setMaxIncense(EntityPlayer player, double amount){
|
||||
NBTTagCompound data = player.getEntityData();
|
||||
data.setDouble(Constants.NBT.MAX_INCENSE, amount);
|
||||
}
|
||||
|
||||
public static double getMaxIncense(EntityPlayer player) {
|
||||
NBTTagCompound data = player.getEntityData();
|
||||
if (data.hasKey(Constants.NBT.MAX_INCENSE)) {
|
||||
return data.getDouble(Constants.NBT.MAX_INCENSE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void setHasMaxIncense(ItemStack stack, EntityPlayer player, boolean isMax) {
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
stack.getTagCompound().setBoolean(Constants.NBT.HAS_MAX_INCENSE, isMax);
|
||||
}
|
||||
public static boolean getHasMaxIncense(ItemStack stack) {
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
return stack.getTagCompound().getBoolean(Constants.NBT.HAS_MAX_INCENSE);
|
||||
}
|
||||
}
|
|
@ -2,8 +2,8 @@ package WayofTime.bloodmagic.util.helper;
|
|||
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.event.SacrificeKnifeUsedEvent;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
|
||||
import WayofTime.bloodmagic.event.SacrificeKnifeUsedEvent;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
|
@ -35,6 +35,9 @@ public class PlayerSacrificeHelper {
|
|||
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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue