import java.util.List;
public class EnderStorageFunctions {
public static ItemStack onFocusRightClick(ItemStack stack, World world, EntityPlayer p, MovingObjectPosition pos) {
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
ItemStack focus=wand.getFocusItem(stack);
if(world.isRemote)
return stack;
if(!focus.hasTagCompound())
focus.setTagCompound(new NBTTagCompound());
if(pos!=null)
{
TileEntity tile = world.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
if (tile instanceof TileEntityEnderChest && p.isSneaking()) {
TileEnderChest chest = (TileEnderChest)tile;
focus.getTagCompound().setInteger("freq", chest.freq);
focus.getTagCompound().setString("owner", chest.owner);
focus.getTagCompound().setBoolean("ender", true);
wand.setFocus(stack, focus);
return stack;
}
if (world.getBlock(pos.blockX, pos.blockY, pos.blockZ) == Blocks.obsidian && p.isSneaking()) {
focus.getTagCompound().setInteger("freq", -1);
focus.getTagCompound().setString("owner", p.getGameProfile().getName());
focus.getTagCompound().setBoolean("ender", false);
wand.setFocus(stack, focus);
return stack;
}
}
boolean vanilla=!focus.getTagCompound().getBoolean("ender");
if (wand.consumeAllVis(stack, p, ItemFocusEnderChest.visUsage, true, false)) {
if(vanilla)
{
p.displayGUIChest(p.getInventoryEnderChest());
world.playSoundAtEntity(p, "mob.endermen.portal", 1F, 1F);
}