try doing this for your onActivated method in the block class
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity == null || player.isSneaking())
{
return false;
}
player.openGui(MyMod.instance, 0, world, x, y, z);
return true;
}
}
and make sure the two methods in the GUI handler have the EXACT same code in each of them, or the inventory will be buggy when it's opened