Slowly working on an experience book for the mod. Changed Curse building to Beta

This commit is contained in:
WayofTime 2016-04-02 16:42:04 -04:00
parent 378c59d2b3
commit 1d14692a93
3 changed files with 50 additions and 1 deletions

View file

@ -213,7 +213,7 @@ curseforge {
project {
id = "${curse_id}"
changelog = getChangelogText()
releaseType = 'alpha'
releaseType = 'beta'
relations curseRelations

View file

@ -6,6 +6,7 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@ -19,6 +20,7 @@ import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.util.helper.TextHelper;
@ -37,6 +39,8 @@ public class ItemExperienceBook extends Item implements IVariantProvider
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
{
tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.experienceTome"));
tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.experienceTome.exp", getStoredExperience(stack)));
}
@Override
@ -53,4 +57,46 @@ public class ItemExperienceBook extends Item implements IVariantProvider
ret.add(new ImmutablePair<Integer, String>(0, "type=experiencetome"));
return ret;
}
public static void setStoredExperience(ItemStack stack, double exp)
{
NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
tag.setDouble("experience", exp);
}
public static double getStoredExperience(ItemStack stack)
{
NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
return tag.getDouble("experience");
}
public static void addExperience(ItemStack stack, double exp)
{
setStoredExperience(stack, getStoredExperience(stack) + exp);
}
public static int getExperienceForNextLevel(int currentLevel)
{
if (currentLevel <= 16)
{
return 2 * currentLevel + 7;
} else if (currentLevel <= 31)
{
return 5 * currentLevel - 38;
} else
{
return 9 * currentLevel - 158;
}
}
public static double getExperienceAcquiredToNext(int currentLevel, double progress)
{
return progress * getExperienceForNextLevel(currentLevel);
}
}

View file

@ -347,6 +347,9 @@ tooltip.BloodMagic.currentType.destructive=Contains: Destructive Will
tooltip.BloodMagic.currentType.vengeful=Contains: Vengeful Will
tooltip.BloodMagic.currentType.steadfast=Contains: Steadfast Will
tooltip.BloodMagic.experienceTome=A book used to store experience
tooltip.BloodMagic.experienceTome.exp=Exp: %0.3f
# Ritual
ritual.BloodMagic.testRitual=Test Ritual
ritual.BloodMagic.waterRitual=Ritual of the Full Spring