This commit is contained in:
Arcaratus 2015-07-10 16:51:00 -04:00
parent 8632aeb253
commit 0d9db7def1

View file

@ -19,7 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class SigilOfHolding extends EnergyItems public class SigilOfHolding extends EnergyItems
{ {
private static int invSize = 4; private static int invSize = 5;
private static final String NBT_CURRENT_SIGIL = "CurrentSigil"; private static final String NBT_CURRENT_SIGIL = "CurrentSigil";
@ -83,7 +83,7 @@ public class SigilOfHolding extends EnergyItems
par3List.add(StatCollector.translateToLocal("tooltip.item.currentitem") + " " + item.getDisplayName()); par3List.add(StatCollector.translateToLocal("tooltip.item.currentitem") + " " + item.getDisplayName());
} }
for (int i = 0; i <= invSize; i++) for (int i = 0; i < invSize; i++)
{ {
if (inv[i] != null) if (inv[i] != null)
{ {
@ -156,11 +156,41 @@ public class SigilOfHolding extends EnergyItems
return par1ItemStack; return par1ItemStack;
} }
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
if (checkAndSetItemOwner(stack, player))
{
int currentSlot = getCurrentItem(stack);
ItemStack[] inv = getInternalInventory(stack);
if (inv == null)
{
return false;
}
ItemStack itemUsed = inv[currentSlot];
if (itemUsed == null)
{
return false;
}
boolean bool = itemUsed.getItem().onItemUseFirst(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
saveInventory(stack, inv);
return bool;
}
return false;
}
public static int next(int mode) public static int next(int mode)
{ {
int index = mode + 1; int index = mode + 1;
if (index >= invSize + 1) if (index >= invSize)
{ {
index = 0; index = 0;
} }
@ -240,7 +270,7 @@ public class SigilOfHolding extends EnergyItems
NBTTagCompound tag = tagList.getCompoundTagAt(i); NBTTagCompound tag = tagList.getCompoundTagAt(i);
int slot = tag.getByte("Slot"); int slot = tag.getByte("Slot");
if (slot >= 0 && slot <= invSize) if (slot >= 0 && slot < invSize)
{ {
inv[slot] = ItemStack.loadItemStackFromNBT(tag); inv[slot] = ItemStack.loadItemStackFromNBT(tag);
} }
@ -260,7 +290,7 @@ public class SigilOfHolding extends EnergyItems
NBTTagList itemList = new NBTTagList(); NBTTagList itemList = new NBTTagList();
for (int i = 0; i <= invSize; i++) for (int i = 0; i < invSize; i++)
{ {
if (inventory[i] != null) if (inventory[i] != null)
{ {
@ -301,7 +331,7 @@ public class SigilOfHolding extends EnergyItems
return; return;
} }
for (int i = 0; i <= invSize; i++) for (int i = 0; i < invSize; i++)
{ {
if (inv[i] == null) if (inv[i] == null)
{ {