Added a cap to how much experience void shards can hold.
This commit is contained in:
parent
b5b2ddec92
commit
23fa343ee6
1 changed files with 10 additions and 3 deletions
|
|
@ -29,14 +29,21 @@ public class ItemVoidShard extends Item {
|
||||||
if (itemStack.stackTagCompound == null)
|
if (itemStack.stackTagCompound == null)
|
||||||
itemStack.setTagCompound(new NBTTagCompound());
|
itemStack.setTagCompound(new NBTTagCompound());
|
||||||
|
|
||||||
int currentExperience = entityPlayer.experienceLevel;
|
int experience = entityPlayer.experienceLevel;
|
||||||
|
int experienceSubtract = entityPlayer.experienceLevel - 30;
|
||||||
|
|
||||||
if (itemStack.stackTagCompound.getBoolean("filled") == false)
|
if (itemStack.stackTagCompound.getBoolean("filled") == false)
|
||||||
{
|
{
|
||||||
if (currentExperience > 0)
|
if (experience > 0 && experience <= 30)
|
||||||
{
|
{
|
||||||
entityPlayer.experienceLevel = 0;
|
entityPlayer.experienceLevel = 0;
|
||||||
itemStack.stackTagCompound.setInteger("xpStored", currentExperience);
|
itemStack.stackTagCompound.setInteger("xpStored", experience);
|
||||||
|
itemStack.stackTagCompound.setBoolean("filled", true);
|
||||||
|
}
|
||||||
|
else if (experience > 30)
|
||||||
|
{
|
||||||
|
entityPlayer.experienceLevel = experienceSubtract;
|
||||||
|
itemStack.stackTagCompound.setInteger("xpStored", 30);
|
||||||
itemStack.stackTagCompound.setBoolean("filled", true);
|
itemStack.stackTagCompound.setBoolean("filled", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue