From 23fa343ee6fa3e833707a5694059bb63467d5795 Mon Sep 17 00:00:00 2001 From: allstar69 Date: Tue, 9 Jul 2013 20:14:47 -0700 Subject: [PATCH] Added a cap to how much experience void shards can hold. --- common/MysticWorld/Items/ItemVoidShard.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/common/MysticWorld/Items/ItemVoidShard.java b/common/MysticWorld/Items/ItemVoidShard.java index 5de545e..16d54d1 100644 --- a/common/MysticWorld/Items/ItemVoidShard.java +++ b/common/MysticWorld/Items/ItemVoidShard.java @@ -29,14 +29,21 @@ public class ItemVoidShard extends Item { if (itemStack.stackTagCompound == null) itemStack.setTagCompound(new NBTTagCompound()); - int currentExperience = entityPlayer.experienceLevel; + int experience = entityPlayer.experienceLevel; + int experienceSubtract = entityPlayer.experienceLevel - 30; if (itemStack.stackTagCompound.getBoolean("filled") == false) { - if (currentExperience > 0) + if (experience > 0 && experience <= 30) { 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); } }